dsmiley commented on a change in pull request #1310: SOLR-13350: Multithreaded 
search using collector managers
URL: https://github.com/apache/lucene-solr/pull/1310#discussion_r397855612
 
 

 ##########
 File path: solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
 ##########
 @@ -1643,6 +1660,83 @@ public ScoreMode scoreMode() {
     qr.setDocList(new DocSlice(0, sliceLen, ids, scores, totalHits, maxScore));
   }
 
+  CollectorManagerResult searchCollectorManagers(int len, QueryCommand cmd, 
Query query,
+      boolean needTopDocs, boolean needMaxScore, boolean needDocSet) throws 
IOException {
+    CollectorManager<MultiCollector, CollectorManagerResult> manager = new 
CollectorManager<MultiCollector, CollectorManagerResult>() {
+      @Override
+      public MultiCollector newCollector() throws IOException {
+        // nocommit: Here, creating a MultiCollector for every segment 
(correctness > speed).
+        // Need to explore sharing a single MultiCollector with every segment. 
Are these
+        // sub-collectors thread-safe? DocSetCollector seems like not 
thread-safe, does someone know?
+        Collection<Collector> collectors = new ArrayList<Collector>();
+        if (needTopDocs) collectors.add(buildTopDocsCollector(len, cmd));
+        if (needMaxScore) collectors.add(new MaxScoreCollector());
+        if (needDocSet) collectors.add(new DocSetCollector(maxDoc()));
+        return (MultiCollector) MultiCollector.wrap(collectors);
+      }
+
+      @Override
+      public CollectorManagerResult reduce(Collection<MultiCollector> 
multiCollectors) throws IOException {
+        final TopDocs[] topDocs = new TopDocs[multiCollectors.size()];
+        float maxScore = 0.0f;
+        DocSet docSet = new BitDocSet(new FixedBitSet(maxDoc())); // TODO: if 
docset is not needed, avoid this initialization
 
 Review comment:
   I disagree that we even need this.  Init to null.  Instead of calling union, 
if null just set it.

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