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

    https://github.com/apache/lucene-solr/pull/496#discussion_r232664496
  
    --- Diff: 
lucene/core/src/java/org/apache/lucene/search/TopFieldCollector.java ---
    @@ -68,6 +68,20 @@ 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) {
    +    final SortField[] fields1 = searchSort.getSort();
    +    final SortField[] fields2 = indexSort.getSort();
    +    return fields1.length == 1 &&
    --- End diff --
    
    It'd be weird, but we can also safely early terminate even if there are 
other sort fields after `docid` right (since `docid` is a total sort)?  So we 
don't need to insist the length is 1?


---

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

Reply via email to