Reputation: 611
For example: I want to search "support", I hope it will only return the results containing "support", and do NOT return the result containing "supports" or any other relevant matches.
Is it possible to implement like this?
Thanks.
Upvotes: 1
Views: 1821
Reputation: 99720
Yes, if you search against an unanalyzed field type, matches are exact. In the default Solr schema the unanalyzed field type is named "string" (of class "solr.StrField")
EDIT: it depends on what you mean by "precisely". If your field value is "support desk" and your query is "support", should it match?
Furthermore, if your query is "supports" and the field value is "Supports", should it match?
In summary, the Lucene/Solr text analysis pipeline is very configurable, take a look at the analyzer docs for a reference of all available options.
Upvotes: 7
Reputation: 158
What you are describing is called stemming. There is another almost identical question on stack overflow, check it out : Solr exact word search You will need to re-index and disable stemming in your configuration. I don't believe it's possible to do that at query time since what is stored in your index is the stemmed version of the word. In your case "support" is stored in the index even is "supports" is displayed. This should get you started How to configure stemming in Solr?
Upvotes: 3