[ 
https://issues.apache.org/jira/browse/LUCENE-3191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047477#comment-13047477
 ] 

Uwe Schindler commented on LUCENE-3191:
---------------------------------------

This still confuses me:

bq. There might only be a bug in RelevanceComparator: Its getValue() method 
returns a comparable that sorts in wrong order. We have no test for this, so it 
might never cause a test failure.

In my opinion, it should return a negative Float object. But as far as I know, 
there was/is already some special case in the collectors merge code used to 
merge segment's results (FieldValueHitQueue.fillFields copys the values into 
the collected docs, but I am not sure if this is still used.

The good old deprecated FieldDocSortedHitQueue in 3.x (what's the replacement?) 
contains this special case:

{code}
} else {
  c = docA.fields[i].compareTo(docB.fields[i]);
  if (type == SortField.SCORE) {
    c = -c;
  }
}
{code}

In trunk it's gone, so we can maybe fix this stupidness. The Comparable 
returned by RelevanceComparator (used with SortField.SCORE) should simply be 
negative? Else we have to add this special case in your TopDocs.merge, too.

> Add TopDocs.merge to merge multiple TopDocs
> -------------------------------------------
>
>                 Key: LUCENE-3191
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3191
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.3, 4.0
>
>         Attachments: LUCENE-3191.patch
>
>
> It's not easy today to merge TopDocs, eg produced by multiple shards,
> supporting arbitrary Sort.

--
This message is automatically generated by JIRA.
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