lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] [Commented] (LUCENE-5222) TestExpressionSorts fails sometimes when using expression returning score
Date Wed, 18 Sep 2013 16:01:52 GMT


Robert Muir commented on LUCENE-5222:

Ok, thats definitely the issue: the problem is that when using an Executor, IndexSearcher
searches each segment and then merges the results with a FakeScorer.

it has a special hack for this case where it actually ignores the boolean options you set,
if the sort itself contains a relevance comparator:

doDocScores || sort.needsScores()

The current implementation is
  /** Whether the relevance score is needed to sort documents. */
  boolean needsScores() {
    for (SortField sortField : fields) {
      if (sortField.getType() == SortField.Type.SCORE) {
        return true;
    return false;

So in the case of the expression sortfield (or any other similar sortfield), the hack does
not work of course, because its a CUSTOM sortfield.

So I think we should change this hack to call SortField.needsScores() ? This way if someone
has a custom one, they can just return true here and all this works.

I will make a stab at a patch.
> TestExpressionSorts fails sometimes when using expression returning score
> -------------------------------------------------------------------------
>                 Key: LUCENE-5222
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Ryan Ernst
> Jenkins picked this up.  Repeat with:
> {code}
> ant test  -Dtestcase=TestExpressionSorts -Dtests.method=testQueries -Dtests.seed=115AD00ED89D9F7B
-Dtests.multiplier=3 -Dtests.slow=true -Dtests.locale=no_NO -Dtests.timezone=America/Nassau
> {code}
> It appears to have to do with scoring, as removing the score sort from the original sorts
causes the tests to pass.  If you remove the possible discrepancy between doDocScores and
docMaxScore params to, then the test gets farther before failing.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message