How is scoring affected by wildcard queries? Seems when I use a
wildcard query I get all constant scores in response (all scores =
1.0). That occurs with both edismax as well as lucene query parser.
I am trying to implement auto-suggest feature so I need to use wild
card to return all results that match the prefix entered by a user.
But I want the results sorted according to score defined by the "qf"
parameter in my search handler.
?defType=edismax&q=grow*&fl=title,score
<result name="response" numFound="11" start="0" maxScore="1.0">
<doc>
<float name="score">1.0</float>
<arr name="title">
<str>S&P 1000 Growth</str>
</arr>
</doc>
<doc>
<float name="score">1.0</float>
<arr name="title">
<str>S&P 1000 Pure Growth</str>
</arr>
</doc>
?defType=lucene&q=grow*&fl=title,score
<result name="response" numFound="11" start="0" maxScore="1.0">
<doc>
<float name="score">1.0</float>
<arr name="title">
<str>S&P 1000 Growth</str>
</arr>
</doc>
<doc>
<float name="score">1.0</float>
<arr name="title">
<str>S&P 1000 Pure Growth</str>
</arr>
</doc>
If I use query with no wildcard, scoring appears correct:
?defType=edismax&q=growth&fl=title,score
<result name="response" numFound="11" start="0" maxScore="0.7500377">
<doc>
<float name="score">0.7500377</float>
<arr name="title">
<str>S&P 1000 Growth</str>
</arr>
</doc>
<doc>
<float name="score">0.7500377</float>
<arr name="title">
<str>S&P 500 Growth</str>
</arr>
</doc>
<doc>
<float name="score">0.656283</float>
<arr name="title">
<str>S&P 1000 Pure Growth</str>
</arr>
</doc>
I am using SOLR version 3.2 and using a request handler defined like this:
<requestHandler name="/idxsuggest" class="solr.SearchHandler">
<lst name="defaults">
<str name="echoParams">explicit</str>
<int name="rows">10</int>
<str name="defType">edismax</str>
<str name="q">*:*</str>
<str name="qf">
ticker^10.0 indexCode^10.0 indexKey^10.0 title^5.0
indexName^5.0
</str>
<str
name="fl">indexId,indexName,indexCode,indexKey,title,ticker,urlTitle</str>
</lst>
<lst name="appends">
<!-- Filter out documents that are not published yet and
that are not yet expired -->
<str name="fq">+contentType:IndexProfile</str>
</lst>
</requestHandler>