You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by dm_tim <dm...@yahoo.com> on 2012/11/02 22:20:43 UTC

Puzzled by search score

Howdy,
I'm reading a table in a db using the following schema:
 <fields>   
  
   <field name="id" type="string" indexed="true" stored="true"
required="true" /> 
   <field name="cid" type="long" indexed="true" stored="true"
required="true"/>
   <field name="lang" type="string" indexed="true" stored="true"
required="true"/>
   <field name="file_version" type="int" indexed="true" stored="true"
required="true"/>
   <field name="search_id" type="long" indexed="true" stored="true"
required="true"/>
   <field name="tag" type="text_general" indexed="true" stored="true"
required="true"/>
   <field name="created" type="date" indexed="false" stored="true"/>
   <field name="last_modified" type="date" indexed="true" stored="true"/>
   <field name="version" type="long" indexed="true" stored="true"/>
   <field name="_version_" type="long" indexed="true" stored="true"
multiValued="false"/>
 </fields>
 
 
 <uniqueKey>id</uniqueKey>

 
 <defaultSearchField>tag</defaultSearchField>

 
 <solrQueryParser defaultOperator="OR"/>
========================================
So make the following query 
http://localhost:8080/apache-solr-4.0.0/core0/select?q=tag%3Aclothes~%2Bcid%3A14&sort=score+desc&rows=10&fl=tag+score&wt=json&indent=true

You will notice that I'm doing a search on the tag field against the string
"clothes" and the cid field against the long 14 and requesting that the
results come back sorted on descending score values. So I'm surprised to see
these results:
{
  "responseHeader":{
    "status":0,
    "QTime":1,
    "params":{
      "q":"tag:clothes~+cid:14",
      "sort":"score desc",
      "rows":"10",
      "fl":"tag score",
      "wt":"json",
      "indent":"true"}},
  "response":{"numFound":1835,"start":0,"maxScore":3.9238024,"docs":[
      {
        "tag":"Table Cloth",
        "score":3.9238024},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Clothes",
        "score":3.9134552},
      {
        "tag":"Boys Clothes",
        "score":3.3968315},
      {
        "tag":"Everyday Clothes",
        "score":3.3968315},
      {
        "tag":"Designer Clothes",
        "score":3.3968315}]
  }}

Why does "Table Cloth" have a higher score than "Clothes" (which is an exact
textual match)? I could use some help understanding why I have these results
and how to tweak my query so that the results match my expectations.

Regards,

Tim



--
View this message in context: http://lucene.472066.n3.nabble.com/Puzzled-by-search-score-tp4017904.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Puzzled by search score

Posted by Otis Gospodnetic <ot...@gmail.com>.
Append &debugQuery=true to your query URL and scroll down to see what is
contributing to the score and how much.

Otis
--
Search Analytics - http://sematext.com/search-analytics/index.html
Performance Monitoring - http://sematext.com/spm/index.html


On Fri, Nov 2, 2012 at 5:20 PM, dm_tim <dm...@yahoo.com> wrote:

> Howdy,
> I'm reading a table in a db using the following schema:
>  <fields>
>
>    <field name="id" type="string" indexed="true" stored="true"
> required="true" />
>    <field name="cid" type="long" indexed="true" stored="true"
> required="true"/>
>    <field name="lang" type="string" indexed="true" stored="true"
> required="true"/>
>    <field name="file_version" type="int" indexed="true" stored="true"
> required="true"/>
>    <field name="search_id" type="long" indexed="true" stored="true"
> required="true"/>
>    <field name="tag" type="text_general" indexed="true" stored="true"
> required="true"/>
>    <field name="created" type="date" indexed="false" stored="true"/>
>    <field name="last_modified" type="date" indexed="true" stored="true"/>
>    <field name="version" type="long" indexed="true" stored="true"/>
>    <field name="_version_" type="long" indexed="true" stored="true"
> multiValued="false"/>
>  </fields>
>
>
>  <uniqueKey>id</uniqueKey>
>
>
>  <defaultSearchField>tag</defaultSearchField>
>
>
>  <solrQueryParser defaultOperator="OR"/>
> ========================================
> So make the following query
>
> http://localhost:8080/apache-solr-4.0.0/core0/select?q=tag%3Aclothes~%2Bcid%3A14&sort=score+desc&rows=10&fl=tag+score&wt=json&indent=true
>
> You will notice that I'm doing a search on the tag field against the string
> "clothes" and the cid field against the long 14 and requesting that the
> results come back sorted on descending score values. So I'm surprised to
> see
> these results:
> {
>   "responseHeader":{
>     "status":0,
>     "QTime":1,
>     "params":{
>       "q":"tag:clothes~+cid:14",
>       "sort":"score desc",
>       "rows":"10",
>       "fl":"tag score",
>       "wt":"json",
>       "indent":"true"}},
>   "response":{"numFound":1835,"start":0,"maxScore":3.9238024,"docs":[
>       {
>         "tag":"Table Cloth",
>         "score":3.9238024},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Clothes",
>         "score":3.9134552},
>       {
>         "tag":"Boys Clothes",
>         "score":3.3968315},
>       {
>         "tag":"Everyday Clothes",
>         "score":3.3968315},
>       {
>         "tag":"Designer Clothes",
>         "score":3.3968315}]
>   }}
>
> Why does "Table Cloth" have a higher score than "Clothes" (which is an
> exact
> textual match)? I could use some help understanding why I have these
> results
> and how to tweak my query so that the results match my expectations.
>
> Regards,
>
> Tim
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Puzzled-by-search-score-tp4017904.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>