Skip to content

Commit

Permalink
Prevent npe during construction
Browse files Browse the repository at this point in the history
  • Loading branch information
cbuescher committed Jul 13, 2023
1 parent 669d092 commit eec5db2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ final class DefaultSearchContext extends SearchContext {
engineSearcher.getQueryCache(),
engineSearcher.getQueryCachingPolicy(),
lowLevelCancellation,
// use the search threadpool for now, TODO maybe we will change to a separate one
// use the search threadpool for now, TODO this will change to a separate one
parallelize ? (EsThreadPoolExecutor) this.indexService.getThreadPool().executor(ThreadPool.Names.SEARCH) : null
);
releasables.addAll(List.of(engineSearcher, searcher));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private ContextIndexSearcher(
boolean wrapWithExitableDirectoryReader,
ThreadPoolExecutor executor
) throws IOException {
// we need to pass the executor up so it can porentially be used as a sliceExecutor
// we need to pass the executor up so it can potentially be used as a sliceExecutor
super(wrapWithExitableDirectoryReader ? new ExitableDirectoryReader((DirectoryReader) reader, cancellable) : reader, executor);
setSimilarity(similarity);
setQueryCache(queryCache);
Expand Down Expand Up @@ -203,7 +203,7 @@ public Weight createWeight(Query query, ScoreMode scoreMode, float boost) throws

@Override
protected LeafSlice[] slices(List<LeafReaderContext> leaves) {
return computeSlices(leaves, queueSizeBasedExecutor.threadPoolExecutor.getPoolSize(), MINIMUM_DOCS_PER_SLICE);
return computeSlices(leaves, ((ThreadPoolExecutor) getExecutor()).getPoolSize(), MINIMUM_DOCS_PER_SLICE);
}

/**
Expand Down

0 comments on commit eec5db2

Please sign in to comment.