I am working with Solr Search. When searching for phrase then ranking is not working fine. For ex if i search for "title:Graphic Designers Need" then title having all three first should come at top then having two words and then single.
I want results in below sequence:
"title": "Specification Graphic Designers Need To Know Every Day",
"title": "Graphic Designers: Insider Secrets from Top Designers",
"title": "Graphic ElementsUnique Elements for Distinctive Designs",
<field name="title" type="case_sensitive" indexed="true" stored="true" required="false" multiValued="false" omitNorms="true"/>
<fieldType name="case_sensitive" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.SnowballPorterFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<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.SnowballPorterFilterFactory"/>
</analyzer>
</fieldType>
Your query does not mean "find all these words in the field title
".
The query is parsed as "search for Graphics
in title
, Designers
in the default search field, and Need
in the default search field.
You'll have to prefix the field name for each term, or use qf
together with (e)dismax. One option is to use title:(Graphics Designers Need)
, or with edismax: q=Graphics Designers Need&qf=title
.
Use debugQuery=true
to see how the score for each document is calculated.