3

In Solr-5.0.0, I have one product_name field. When I search for a word or more than words, its giving results with product names that contain the words. How can I make it as the exact match come first.

My Schema.xml is below:

<field name="product_name" type="text_wslc" indexed="true" stored="true" required="true" multiValued="false"/>

and my field definition is also given below:

<fieldType name="text_wslc" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.WordDelimiterFilterFactory"
                             generateWordParts="1"
                             generateNumberParts="1"
                             catenateWords="1"
                             catenateNumbers="1"
                             catenateAll="1"
                             preserveOriginal="1"
                             />
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English" />
    <filter class="solr.PorterStemFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.WordDelimiterFilterFactory"
                             generateWordParts="1"
                             generateNumberParts="1"
                             catenateWords="1"
                             catenateNumbers="1"
                             catenateAll="1"
                             preserveOriginal="1"
                             />
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.SnowballPorterFilterFactory" language="English" />
    <filter class="solr.PorterStemFilterFactory"/>
    <filter class="solr.KStemFilterFactory"/>
    <filter class="solr.EnglishMinimalStemFilterFactory"/>
  </analyzer>
</fieldType>

Any boosting needed at index time or query time? Or any thing else?

sehe
  • 374,641
  • 47
  • 450
  • 633
User1234
  • 205
  • 3
  • 9
  • 1
    You are looking for query time boosting using Dismax. Check this https://wiki.apache.org/solr/DisMaxQParserPlugin#pf_.28Phrase_Fields.29 also see examples at the end of the page. – jay Jun 05 '15 at 06:19
  • 1
    This post could help you: http://stackoverflow.com/questions/2630879/solr-exact-word-search – Bruno dos Santos Jun 06 '15 at 03:59
  • 1
    @jay I have added one more copyFiled – User1234 Jun 09 '15 at 09:02
  • 1
    @jay I have added one more copyFiled then i queried like this but it wont give the expected result http://localhost:8983/solr/Dummy2/select?q=(laptop bag)&qf=nameSrting^222+product_name^0.1&defType=dismax nameSrting is the copy field of product_name why? – User1234 Jun 09 '15 at 09:37

0 Answers0