[
https://issues.apache.org/jira/browse/LUCENE-5128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13714653#comment-13714653
]
Shai Erera commented on LUCENE-5128:
------------------------------------
So, while not sending a query to a shard which will return no results is
logically ok, there is an issue with it. TopDocs.merge merges TopDocs[] and
part of the process is to compute a totalHitsCount, so that the merged
TopDocs.totalHits is the sum of all shards' totalHits. Now, imagine that we
didn't submit a query to a shard with no more results, then what would happen
is that the previous search would return mergedTotalHits=N and the follow-on
search (e.g. clicking 'next') would return mergedTotalHits=N-K, where K is the
totalHits from the shard that we omitted.
Fixing the test is not easy unless we cache somewhere the totalHits from the
previous round. And I assume an app will need to do that too if it wants to
omit a shard from a search. But this looks unrelated to this issue, i.e. it's
some sort of optimization that we need to put somewhere, maybe searchAfter
should also record totalHits for that shard, I'm not sure. But it's unrelated
to this issue.
So I think at this point it would be better to fix whatever collector that is
sensitive to searchAfter exceeding maxDoc, than to fix IndexSearcher to fail
fast.
> Calling IndexSearcher.searchAfter beyond the number of stored documents
> causes ArrayIndexOutOfBoundsException
> -------------------------------------------------------------------------------------------------------------
>
> Key: LUCENE-5128
> URL: https://issues.apache.org/jira/browse/LUCENE-5128
> Project: Lucene - Core
> Issue Type: Bug
> Components: core/search
> Affects Versions: 4.2
> Reporter: crocket
> Attachments: LUCENE-5128.patch
>
>
> ArrayIndexOutOfBoundsException makes it harder to reason about the cause.
> Is there a better way to notify programmers of the cause?
--
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]