Skip to content

Commit

Permalink
restored comment
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed May 10, 2023
1 parent 8305995 commit 8500010
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lucene/core/src/java/org/apache/lucene/search/IndexSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,32 +669,31 @@ private <C extends Collector, T> T search(
"CollectorManager does not always produce collectors with the same score mode");
}
}
final List<FutureTask<C>> listTasks = new ArrayList<>();
final List<FutureTask<Void>> listTasks = new ArrayList<>();
for (int i = 0; i < leafSlices.length; ++i) {
final LeafReaderContext[] leaves = leafSlices[i].leaves;
final C collector = collectors.get(i);
FutureTask<C> task =
FutureTask<Void> task =
new FutureTask<>(
() -> {
search(Arrays.asList(leaves), weight, collector);
return collector;
return null;
});

listTasks.add(task);
}

sliceExecutor.invokeAll(listTasks);
final List<C> collectedCollectors = new ArrayList<>();
for (Future<C> future : listTasks) {
for (Future<Void> future : listTasks) {
try {
collectedCollectors.add(future.get());
future.get();
} catch (InterruptedException e) {
throw new ThreadInterruptedException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
return collectorManager.reduce(collectedCollectors);
return collectorManager.reduce(collectors);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ final void invokeAll(Collection<? extends Runnable> tasks) {
}

boolean shouldExecuteOnCallerThread(int index, int numTasks) {
//Execute last task on caller thread
return index == numTasks - 1;
}
}

0 comments on commit 8500010

Please sign in to comment.