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

Michael McCandless commented on LUCENE-5515:
--------------------------------------------

+1

It's nice that ElasticSearch is trying to use TopDocs.merge here :)

Seems like this:

bq. if (availHitCount < start) {

Could be <= instead?  Ie, the == case is still 0 hits returned?

Maybe move the entire while loop into the "else"?  And move
numIterOnHits into the else too.

The javadocs state that the returned scoreDocs will have length always
equal to size, but that's only true if there were enough hits right?
Maybe change it to "at most size"?


> Improve TopDocs#merge for pagination
> ------------------------------------
>
>                 Key: LUCENE-5515
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5515
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Martijn van Groningen
>            Assignee: Martijn van Groningen
>            Priority: Minor
>             Fix For: 4.8
>
>         Attachments: LUCENE-5515.patch
>
>
> If TopDocs#merge takes from and size into account it can be optimized to 
> create a hits ScoreDoc array equal to size instead of from+size what is now 
> the case.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to