jpountz commented on a change in pull request #725: LUCENE-8865: Use incoming 
thread for execution if IndexSearcher has an executor
URL: https://github.com/apache/lucene-solr/pull/725#discussion_r294398016
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
 ##########
 @@ -636,16 +636,45 @@ public TopFieldDocs reduce(Collection<TopFieldCollector> 
collectors) throws IOEx
       query = rewrite(query);
       final Weight weight = createWeight(query, scoreMode, 1);
       final List<Future<C>> topDocsFutures = new 
ArrayList<>(leafSlices.length);
+
       for (int i = 0; i < leafSlices.length; ++i) {
         final LeafReaderContext[] leaves = leafSlices[i].leaves;
         final C collector = collectors.get(i);
-        topDocsFutures.add(executor.submit(new Callable<C>() {
-          @Override
-          public C call() throws Exception {
+        if (i == leafSlices.length-1) { // execute the last on the caller 
thread
+          search(Arrays.asList(leaves), weight, collector);
+          topDocsFutures.add(new Future<>() {
 
 Review comment:
   use `CompletableFuture#completedFuture`?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to