fix crash

This commit is contained in:
Andrea Cavalli 2022-08-24 14:30:16 +02:00
parent 1c02a601bc
commit 67d3797df8

View File

@ -793,15 +793,12 @@ public class LuceneUtils {
LocalQueryParams queryParams, LocalQueryParams queryParams,
String keyFieldName, String keyFieldName,
GlobalQueryRewrite transformer) { GlobalQueryRewrite transformer) {
return Mono.usingWhen(indexSearcherMono, indexSearcher -> { return Mono.usingWhen(indexSearcherMono.map(LLIndexSearchers::unsharded), indexSearchers -> Mono
try (UnshardedIndexSearchers indexSearchers = LLIndexSearchers.unsharded(indexSearcher)) {
return Mono
.fromCallable(() -> transformer.rewrite(indexSearchers, queryParams)) .fromCallable(() -> transformer.rewrite(indexSearchers, queryParams))
.transform(LuceneUtils::scheduleLucene) .transform(LuceneUtils::scheduleLucene)
.flatMap(queryParams2 -> .flatMap(queryParams2 ->
localSearcher.collect(indexSearcherMono, queryParams2, keyFieldName, NO_REWRITE)); localSearcher.collect(indexSearcherMono, queryParams2, keyFieldName, NO_REWRITE)),
} LLUtils::finalizeResource);
}, LLUtils::finalizeResource);
} }
/** /**