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

Shai Erera commented on LUCENE-5128:
------------------------------------

bq. it should do its own tracking

That's the part that bothers me. If we don't allow passing such searchAfter, 
we're basically telling apps that they should keep track of their shards, which 
means they need to maintain state (not that it's hard to maintain in this 
case). I'd rather first see the exception because from what I checked both 
TopScoreDocsCollector and TopFieldsCollector should be fine with searchAfter >= 
reader.maxDoc(), and IndexSearch.searchAfter returns a TopDocs so there aren't 
many collectors which can be affected. Except maybe if crocket uses 
DrillSideways...

On one hand the core fix makes sense, on the other hand it may unnecessarily 
complicate apps life. Especially if they need to obtain totalHits ... I wonder 
if in that case they can run with TotalHitCountCollector instead and construct 
an empty TopDocs? That's what happens when you currently pass 
searchAfter=Integer.MAX_VALUE. I'll try to fix the test like that to see if it 
helps.
                
> 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]

Reply via email to