jimczi 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_r330395781
 
 

 ##########
 File path: 
lucene/suggest/src/java/org/apache/lucene/search/suggest/document/NRTSuggester.java
 ##########
 @@ -200,23 +201,30 @@ protected boolean acceptResult(Util.FSTPath<Pair<Long, 
BytesRef>> path) {
         if (!scorer.accept(docID, acceptDocs)) {
           return false;
         }
+        boolean duplicateSurfaceForm = false;
+        boolean collected = false;
         if (collector.doSkipDuplicates()) {
           // now record that we've seen this surface form:
           char[] key = new char[spare.length()];
           System.arraycopy(spare.chars(), 0, key, 0, spare.length());
           if (collector.seenSurfaceForms.contains(key)) {
             // we already collected a higher scoring document with this key, 
in this segment:
-            return false;
+            duplicateSurfaceForm = true;
+          } else {
+            collector.seenSurfaceForms.add(key);
 
 Review comment:
   We should not add the key if we decide to ignore the document below ? 

----------------------------------------------------------------
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