lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "G, Rajesh" ...@cebglobal.com>
Subject RE: Explain score is different from score
Date Mon, 21 Mar 2016 07:30:44 GMT
Hi Ahmet,

I am using solr 5.5.0. I am running single instance with single core. No shards

I have added <similarity class="solr.BM25SimilarityFactory"/> to my schema as suggested
by Rick Sullivan. Now the scores are same between explain and score field.

But instead of previous results "Lync - Microsoft Office 365" and "Microsoft Office 365" I
am getting

{
        "title":"Office 365",
        "score":7.471676
},
{
       "title":"Office 365",
        "score":7.471676
},

If I try NGram title:(Microsoft Ofice 365)

The scores are same for top 10 results even though they are differing by min of 3 characters.
I have attached my schema.xml so it can help

<doc>
    <str name="title">Lync - Microsoft Office 365</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 1.0</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 14.0</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 14.3</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 14.4</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 14.5(Mac)</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 15.0</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 16.0</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 4.0</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Office 365 E4</str>
    <float name="score">52.056263</float></doc>
  <doc>
    <str name="title">Microsoft Mail Protection Reports for Office 365 15.0</str>
    <float name="score">50.215454</float></doc>

Thanks
Rajesh



Corporate Executive Board India Private Limited. Registration No: U741040HR2004PTC035324.
Registered office: 6th Floor, Tower B, DLF Building No.10 DLF Cyber City, Gurgaon, Haryana-122002,
India.

This e-mail and/or its attachments are intended only for the use of the addressee(s) and may
contain confidential and legally privileged information belonging to CEB and/or its subsidiaries,
including CEB subsidiaries that offer SHL Talent Measurement products and services. If you
have received this e-mail in error, please notify the sender and immediately, destroy all
copies of this email and its attachments. The publication, copying, in whole or in part, or
use or dissemination in any other way of this e-mail and attachments by anyone other than
the intended person(s) is prohibited.

-----Original Message-----
From: Ahmet Arslan [mailto:iorixxx@yahoo.com]
Sent: Sunday, March 20, 2016 2:10 AM
To: solr-user@lucene.apache.org; G, Rajesh <rg@cebglobal.com>; rick@ricksullivan.net
Subject: Re: Explain score is different from score

Hi Rick and Rajesh,

I wasn't able re-produce this neither with lucene nor solr.
What version of solr is this?
Are you using a sharded request?

@BeforeClass
public static void beforeClass() throws Exception { initCore("solrconfig.xml", "schema.xml");

assertU(adoc("id", "1722669", "title", "Lync - Microsoft Office 365")); assertU(adoc("id",
"2043876", "title", "Microsoft Office 365"));

assertU(commit());

}

/**
* Checks whether fl=score equals to Explain's score */ @Test public void testExplain() throws
Exception { SolrQueryRequest req = req(CommonParams.DEBUG_QUERY, "true", "indent", "true",
"q", "title:(Microsoft Ofice 365)", CommonParams.FL, "id,title,score"); String response =
h.query(req); System.out.println(response); }

@Test
public void testExplain() throws Exception {

Analyzer analyzer = new WhitespaceAnalyzer();

Directory directory = new RAMDirectory();

IndexWriterConfig config = new IndexWriterConfig(analyzer); config.setSimilarity(new ClassicSimilarity());
IndexWriter iwriter = new IndexWriter(directory, config);

Document doc = new Document();
doc.add(new Field("id", "1722669", TextField.TYPE_STORED)); doc.add(new Field("title", "Lync
- Microsoft Office 365", TextField.TYPE_STORED)); iwriter.addDocument(doc);

doc = new Document();
doc.add(new Field("id", "2043876", TextField.TYPE_STORED)); doc.add(new Field("title", "Microsoft
Office 365", TextField.TYPE_STORED)); iwriter.addDocument(doc);


iwriter.close();

// Now search the index:
DirectoryReader reader = DirectoryReader.open(directory); IndexSearcher searcher = new IndexSearcher(reader);
searcher.setSimilarity(new ClassicSimilarity());

QueryParser parser = new QueryParser("title", analyzer); Query query = parser.parse("Microsoft
Ofice 365"); ScoreDoc[] hits = searcher.search(query, 10).scoreDocs;

Assert.assertEquals(2, hits.length);

// Iterate through the results:
for (int i = 0; i < hits.length; i++) {

Document hitDoc = searcher.doc(hits[i].doc); Explanation explanation = searcher.explain(query,
hits[i].doc);

Assert.assertEquals("score from explain should equal to ScoreDoc.score!", hits[i].score, explanation.getValue(),
0.0);

}


reader.close();
directory.close();

}





On Saturday, March 19, 2016 7:54 AM, "G, Rajesh" <rg@cebglobal.com> wrote:
I don’t use boost at index time and query time.



Corporate Executive Board India Private Limited. Registration No: U741040HR2004PTC035324.
Registered office: 6th Floor, Tower B, DLF Building No.10 DLF Cyber City, Gurgaon, Haryana-122002,
India.

This e-mail and/or its attachments are intended only for the use of the addressee(s) and may
contain confidential and legally privileged information belonging to CEB and/or its subsidiaries,
including CEB subsidiaries that offer SHL Talent Measurement products and services. If you
have received this e-mail in error, please notify the sender and immediately, destroy all
copies of this email and its attachments. The publication, copying, in whole or in part, or
use or dissemination in any other way of this e-mail and attachments by anyone other than
the intended person(s) is prohibited.


-----Original Message-----
From: Rick Sullivan [mailto:rick@ricksullivan.net]
Sent: Friday, March 18, 2016 10:18 PM
To: solr-user@lucene.apache.org
Subject: RE: Explain score is different from score

I'm not. I only have query boosts.

----------------------------------------
> Date: Fri, 18 Mar 2016 16:42:36 +0000
> From: iorixxx@yahoo.com.INVALID
> To: solr-user@lucene.apache.org
> Subject: Re: Explain score is different from score
>
> Hi Rick,
>
> This could be a bug I think. Do you guys use index time boosts?
>
> Ahmet
>
>
>
> On Friday, March 18, 2016 6:15 PM, Rick Sullivan <rick@ricksullivan.net> wrote:
> Yes it seems to be something similar, but the normalization isn't applied to all retrieved
documents, which messes with the document rankings.
>
> Some documents have the exact values from the 'explain' response, while others are normalized.
>
> -Rick
>
>
> ----------------------------------------
>> Date: Fri, 18 Mar 2016 16:06:19 +0000
>> From: iorixxx@yahoo.com.INVALID
>> To: solr-user@lucene.apache.org
>> Subject: Re: Explain score is different from score
>>
>> Hi Rajesh,
>>
>> I suspect it is due to the queryNorm(q). But it is weird that relative order is different
in your example.
>>
>>
>> "queryNorm(q) is a normalizing factor used to make scores between
>> queries comparable. This factor does not affect document ranking
>> (since all ranked documents are multiplied by the same factor), but
>> rather just attempts to make scores from different queries (or even
>> different indexes) comparable." [1]
>>
>> [1]
>> https://lucene.apache.org/core/5_5_0/core/org/apache/lucene/search/si
>> milarities/TFIDFSimilarity.html
>>
>> Ahmet
>>
>>
>> On Friday, March 18, 2016 4:24 PM, Rick Sullivan <rick@ricksullivan.net> wrote:
>> Hi Rajesh,
>>
>> I've been seeing the same problem you have. My debug scores seem to be what I expect,
but the actual scores applied by Solr are sometimes divided by an integer.
>>
>> I raised the same question in this email distribution about a week ago, but haven't
yet found a solution. There's also a StackOverflow question I created here:
>> http://stackoverflow.com/questions/35921106/how-and-why-do-solr-expla
>> in-values-differ-from-the-solr-score
>>
>> Can you verify whether all of your affected scores are (1/N)*score? I
>> think N seems to be the number of OR elements in the query. For
>> example, your case below has
>>
>> debug_score/score
>> = 1.2517526/0.41725087
>> = 3
>>
>> Thanks,
>> -Rick
>>
>>
>> ----------------------------------------
>>> From: rg@cebglobal.com
>>> To: solr-user@lucene.apache.org
>>> Subject: RE: Explain score is different from score
>>> Date: Fri, 18 Mar 2016 13:29:14 +0000
>>>
>>> Can someone help?
>>>
>>>
>>>
>>>
>>> Corporate Executive Board India Private Limited. Registration No: U741040HR2004PTC035324.
Registered office: 6th Floor, Tower B, DLF Building No.10 DLF Cyber City, Gurgaon, Haryana-122002,
India..
>>>
>>>
>>>
>>> This e-mail and/or its attachments are intended only for the use of the addressee(s)
and may contain confidential and legally privileged information belonging to CEB and/or its
subsidiaries, including CEB subsidiaries that offer SHL Talent Measurement products and services.
If you have received this e-mail in error, please notify the sender and immediately, destroy
all copies of this email and its attachments. The publication, copying, in whole or in part,
or use or dissemination in any other way of this e-mail and attachments by anyone other than
the intended person(s) is prohibited.
>>>
>>>
>>> From: G, Rajesh
>>> Sent: Friday, March 18, 2016 12:56 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Explain score is different from score
>>>
>>> Mismatch in score displayed in debug and score field. Please refer attached xml.
>>>
>>> When I search for title_ws:(Microsoft Ofice 365). If the results are displayed
by explain score order then we would have the expected result “Microsoft Office 365” then
“Lync - Microsoft Office 365”
>>>
>>> <result name="response" numFound="13617" start="0"
>>> maxScore="1.0952835"> <doc> <str name="title">Lync - Microsoft
>>> Office 365</str> <str name="title_ws">Lync - Microsoft Office
>>> 365</str> <int name="id">1722669</int> <float
>>> name="score">1.0952835</float></doc> Score from explain 1.0952835
>>> <doc> <str name="title">Microsoft Office 365</str> <str
>>> name="title_ws">Microsoft Office 365</str> <int
>>> name="id">2043876</int> <float name="score">0.41725087</float></doc>
>>> Score from explain 1.2517526 </result>
>>>
>>> Thanks
>>> Rajesh
Mime
View raw message