javanna commented on a change in pull request #622:
URL: https://github.com/apache/lucene/pull/622#discussion_r791803590



##########
File path: 
lucene/misc/src/test/org/apache/lucene/misc/search/TestDocValuesStatsCollector.java
##########
@@ -396,10 +394,8 @@ public void testDocsWithSortedSetValues() throws 
IOException {
       try (DirectoryReader reader = DirectoryReader.open(indexWriter)) {
         IndexSearcher searcher = new IndexSearcher(reader);
         SortedSetDocValuesStats stats = new SortedSetDocValuesStats(field);
-        TotalHitCountCollector totalHitCount = new TotalHitCountCollector();
-        searcher.search(
-            new MatchAllDocsQuery(),
-            MultiCollector.wrap(totalHitCount, new 
DocValuesStatsCollector(stats)));
+
+        searcher.search(new MatchAllDocsQuery(), new 
DocValuesStatsCollector(stats));

Review comment:
       I am possibly missing something here: two collectors were used, but the 
total hits were never retrieved from the total hit count collector. Removing 
its usage seems ok according to tests. Is this ok to change?

##########
File path: 
lucene/misc/src/test/org/apache/lucene/misc/search/TestMemoryAccountingBitsetCollector.java
##########
@@ -64,14 +62,12 @@ public void 
testMemoryAccountingBitsetCollectorMemoryLimit() {
     CollectorMemoryTracker tracker =
         new CollectorMemoryTracker("testMemoryTracker", 
perCollectorMemoryLimit);
     MemoryAccountingBitsetCollector bitSetCollector = new 
MemoryAccountingBitsetCollector(tracker);
-    TotalHitCountCollector hitCountCollector = new TotalHitCountCollector();
 
     IndexSearcher searcher = new IndexSearcher(reader);
     expectThrows(
         IllegalStateException.class,
         () -> {
-          searcher.search(
-              new MatchAllDocsQuery(), MultiCollector.wrap(hitCountCollector, 
bitSetCollector));
+          searcher.search(new MatchAllDocsQuery(), bitSetCollector);

Review comment:
       here too: two collectors were used, but the total hits were never 
retrieved from the total hit count collector. Removing its usage seems ok 
according to tests. Is this ok to change?

##########
File path: 
lucene/core/src/java/org/apache/lucene/search/TotalHitCountCollectorManager.java
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.search;
+
+import java.io.IOException;
+import java.util.Collection;
+
+/**
+ * Collector manager based on {@link TotalHitCountCollector} that allows users 
to parallelize
+ * counting the number of hits.
+ */
+public class TotalHitCountCollectorManager

Review comment:
       I asked myself the same question: will users also need it once we 
deprecate IndexSearcher#search(Query, Collector) ? My guess would be yes but I 
can be convinced otherwise.




-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



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

Reply via email to