If these are the complete field, i.e. your document contains exactly "ear phones" and not "ear phones are great" use a copyField to put it into an "exact_match" field that uses a much simpler analysis chain based on KeywordTokenizer (plus, perhaps things like lowercaseFilter, maybe strip punctuation and the like". Then you add a clause on exact_match boosted really high.
Best, Erick On Tue, Jun 14, 2016 at 1:01 AM, Naveen Pajjuri <pajjuri.re...@myntra.com> wrote: > Hi, > > I have documents with a field (data type definition for that field is > below) values as ear phones, sony ear phones, philips ear phones. when i > query for earphones sony ear phones is the top result where as i want ear > phones as top result. please suggest how to boost exact matches. PS: I have > earphones => ear phones in my synonyms.txt and the datatype definition for > that field keywords is <fieldType name="text" class="solr.TextField" > positionIncrementGap="100"> <analyzer type="index"> <tokenizer class= > "solr.WhitespaceTokenizerFactory"/> <filter class="solr.StopFilterFactory" > ignoreCase="true" words="stopwords.txt"/> <filter class= > "solr.LowerCaseFilterFactory"/> <filter class="solr.SynonymFilterFactory" > synonyms="synonyms.txt" ignoreCase="true" expand="true"/> <filter class= > "solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> <analyzer type= > "query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class= > "solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/> <filter > class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" > expand="true"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class= > "solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </fieldType> REGARDS, > Naveen