Solr does not search into integers?

前端 未结 3 637
梦如初夏
梦如初夏 2021-01-15 15:36

I\'m currently developping a search engine using Solr for an ecommerce website. So I get these two fields in my schema.xml:

   

        
3条回答
  •  -上瘾入骨i
    2021-01-15 16:17

    Based on the behavior described it sounds like you're trying to use basic SearchHandler query syntax out of the box to search against multiple fields. That's not going to work out as you'd hope.

    There are numerous options available:

    1. Front-end the query so that fully-qualified field names get sent (eg "fielda:foo OR fieldb:foo")
    2. Copy the contents of searchable fields into a single search field (through copyField) and make that the default field to search
    3. Use Solr Dismax syntax and specify multiple QueryFields (qf parameter in the request)

    Since you have fields of different types, and want to apply wildcard matching and other such things, I'd recommend you go the Dismax route and look into creating a Query Handler that better suits your needs:

    More info on:

    • The default SearchHandler: http://wiki.apache.org/solr/SearchHandler
    • Solr with Dismax: http://wiki.apache.org/solr/DisMaxQParserPlugin

提交回复
热议问题