msokolov commented on a change in pull request #1316: LUCENE-8929 parallel 
early termination in TopFieldCollector using minmin score
URL: https://github.com/apache/lucene-solr/pull/1316#discussion_r396134232
 
 

 ##########
 File path: 
lucene/core/src/java/org/apache/lucene/search/ParallelSortedCollector.java
 ##########
 @@ -0,0 +1,612 @@
+/*
+ * 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.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.PriorityQueue;
+
+import org.apache.lucene.index.LeafReaderContext;
+import org.apache.lucene.search.FieldValueHitQueue.Entry;
+import org.apache.lucene.search.TotalHits.Relation;
+
+/**
+ * A {@link Collector} for results sorted by field, optimized for early 
termination in
+ * the case where the {@link Sort} matches the index and the search is 
executed in parallel,
+ * using multiple threads.
+ *
+ * @lucene.experimental
+ */
 
 Review comment:
   > I wonder why it should be reserved for parallel collection ?
   ah, true, although somehow I think it would be less impactful in the serial 
case.  Also the terminator does not have to be synchronized then, I guess we 
could have two implementations like the threshold checker. I'll see if I can 
get the serial case covered.
   
   > ...  why MaxScoreTerminator also handles leave states
   The idea is that when one leaf terminates, the global max score may be 
updated to the max score of *some other leaf*.  That's why we have this queue 
of leaf states. We don't want to wait for that other leaf to collect() so it 
can check in to perform this update since it may already have finished 
collection. Also, we track not only the global max score, but also the number 
of hits collected by terminated collectors, and their last docid, for 
tiebreaking. I'll see if I can move more of the logic into the leaf collector, 
I agree that would be preferable to duplicating state like this, but given the 
need to sort the leaves (not the leaf collectors), I'm not sure how much we can 
do.

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