[ 
http://issues.apache.org/jira/browse/LUCENE-697?page=comments#action_12447234 ] 
            
Doron Cohen commented on LUCENE-697:
------------------------------------

You're right Yonik,   pp1.offset < pp2.offset   is equivalent. 

However note that pp1.position + pp1.offset  == tp1.position, i.e. by adding 
the (query) offset we compare the termPosition offsets, as read from the index. 

Just to complete the setting - having pp.position == tp.position - offset 
allows the phrase scorer to identify a match when all pp.positions are the same 
(for exact) or distant no more than slope (for sloppy). 

So we should probably return the simpler expression as you suggest, and comment 
the code, something like this:

    if (pp1.doc == pp2.doc) 
      if (pp1.position == pp2.position)
        // Same doc and pp.positions, so compare *actual term positions*.
        // Since pp.position == tp.position - (query) offset, 
        // can restore tp.position as pp.position + offset.
        // But pp.positions are equal, so can just compare the offsets. 
        return pp1.offset < pp2.offset;
      else
        return pp1.position < pp2.position;
    else
      return pp1.doc < pp2.doc;

makes sense?

Perhaps it would be nice if we also add some code comments to the scorers...?

> Scorer.skipTo affects sloppyPhrase scoring
> ------------------------------------------
>
>                 Key: LUCENE-697
>                 URL: http://issues.apache.org/jira/browse/LUCENE-697
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 2.0.0
>            Reporter: Yonik Seeley
>         Assigned To: Doron Cohen
>         Attachments: sloppy_phrase_skipTo.patch, sloppy_phrase_skipTo.patch2
>
>
> If you mix skipTo() and next(), you get different scores than what is 
> returned to a hit collector.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to