[
https://issues.apache.org/jira/browse/LUCENE-5222?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13770909#comment-13770909
]
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:
{code}
doDocScores || sort.needsScores()
{code}
The current implementation is
{code}
/** 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;
}
{code}
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: https://issues.apache.org/jira/browse/LUCENE-5222
> 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
> -Dtests.file.encoding=US-ASCII
> {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 searcher.search,
> 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: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]