Github user jimczi commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/496#discussion_r232991616
  
    --- Diff: 
lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java ---
    @@ -68,6 +68,18 @@ public void setScorer(Scorable scorer) throws 
IOException {
       }
     
       static boolean canEarlyTerminate(Sort searchSort, Sort indexSort) {
    +    return canEarlyTerminateOnDocId(searchSort, indexSort) ||
    +           canEarlyTerminateOnPrefix(searchSort, indexSort);
    +  }
    +
    +  private static boolean canEarlyTerminateOnDocId(Sort searchSort, Sort 
indexSort) {
    --- End diff --
    
    Today early termination is activated if the search sort is a prefix of the 
index sort. With this pr we add a new case for early termination that should be 
activated when the search sort uses SortField.DOC. The early termination is 
possible in this case because docs are visited in doc id order so the first 
visited document is the also the best document, the second visited is the 
second best document, and so on. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to