javanna commented on code in PR #16133:
URL: https://github.com/apache/lucene/pull/16133#discussion_r3322804990


##########
lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestProfilerCollector.java:
##########
@@ -86,6 +94,35 @@ protected String deriveCollectorName(Collector c) {
     assertEquals("TestCollector(TotalHitCountCollector)", collector.getName());
   }
 
+  public void testCompetitiveIteratorDelegation() throws IOException {

Review Comment:
   This is a good test that's specific to the profiler collector, thanks for 
adding it
   
   The fix is general, hence it may be good to add a test that subclasses 
`FilterLeafCollector` directly and verifies that delegating is a functionality 
provided directly by `FilterLeafCollector`. Otherwise the fix could be specific 
to the profilter collector wrapper.
   



##########
lucene/sandbox/src/test/org/apache/lucene/sandbox/search/TestProfilerCollector.java:
##########
@@ -86,6 +94,35 @@ protected String deriveCollectorName(Collector c) {
     assertEquals("TestCollector(TotalHitCountCollector)", collector.getName());
   }
 
+  public void testCompetitiveIteratorDelegation() throws IOException {
+    Directory dir = newDirectory();
+    RandomIndexWriter w = new RandomIndexWriter(random(), dir);
+    final int numDocs = TestUtil.nextInt(random(), 10, 100);
+    for (int i = 0; i < numDocs; i++) {
+      Document doc = new Document();
+      doc.add(new LongPoint("score", i));
+      doc.add(new NumericDocValuesField("score", i));
+      w.addDocument(doc);
+    }
+    w.forceMerge(1);
+    DirectoryReader reader = w.getReader();
+    w.close();
+
+    SortField sortField = new SortField("score", SortField.Type.LONG);
+    TopFieldCollectorManager topFieldCollectorManager =
+        new TopFieldCollectorManager(new Sort(sortField), 1, 
Integer.MAX_VALUE);
+
+    ProfilerCollectorWrapper wrapper =
+        new ProfilerCollectorWrapper(topFieldCollectorManager.newCollector());
+    LeafCollector leafCollector = 
wrapper.getLeafCollector(reader.leaves().get(0));
+
+    DocIdSetIterator competitiveIterator = leafCollector.competitiveIterator();
+    assertNotNull(competitiveIterator);

Review Comment:
   Could we check that the competitive iterator returned is meaningful, and 
provides the expected functionality, besides it being non null? 



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to