mikemccand commented on a change in pull request #913: LUCENE-8995: 
TopSuggestDocsCollector#collect should be able to signal rejection
URL: https://github.com/apache/lucene-solr/pull/913#discussion_r334992844
 
 

 ##########
 File path: 
lucene/suggest/src/java/org/apache/lucene/search/suggest/document/TopSuggestDocs.java
 ##########
 @@ -116,19 +133,29 @@ public TopSuggestDocs(TotalHits totalHits, 
SuggestScoreDoc[] scoreDocs) {
    */
   public static TopSuggestDocs merge(int topN, TopSuggestDocs[] shardHits) {
     SuggestScoreDocPriorityQueue priorityQueue = new 
SuggestScoreDocPriorityQueue(topN);
+    boolean allComplete = true;
     for (TopSuggestDocs shardHit : shardHits) {
       for (SuggestScoreDoc scoreDoc : shardHit.scoreLookupDocs()) {
         if (scoreDoc == priorityQueue.insertWithOverflow(scoreDoc)) {
           break;
         }
       }
+      allComplete &= shardHit.isComplete;
     }
     SuggestScoreDoc[] topNResults = priorityQueue.getResults();
     if (topNResults.length > 0) {
-      return new TopSuggestDocs(new TotalHits(topNResults.length, 
TotalHits.Relation.EQUAL_TO), topNResults);
+      return new TopSuggestDocs(new TotalHits(topNResults.length, 
TotalHits.Relation.EQUAL_TO), topNResults,
+          allComplete);
     } else {
       return TopSuggestDocs.EMPTY;
     }
   }
 
+  /**
+   * Indicates if the list of results is complete or not. Might be 
<code>false</code> if the {@link TopNSearcher} rejected
+   * too many of the queued results.
 
 Review comment:
   Isn't it sometimes `false` if the `TopNSearcher`'s queue filled up and it 
chose not to pursue some low-scoring partial paths?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to