add fast path

This commit is contained in:
Andrea Cavalli 2022-03-16 00:32:00 +01:00
parent a20bb9c423
commit 8999102038

View File

@ -184,6 +184,11 @@ public class LuceneIndexImpl<T, U> implements LuceneIndex<T, U> {
}
private static Mono<LLSearchResultShard> mergeResults(List<LLSearchResultShard> shards) {
if (shards.size() == 0) {
return Mono.empty();
} else if (shards.size() == 1) {
return Mono.just(shards.get(0));
}
return Mono.fromCallable(() -> {
TotalHitsCount count = null;
ObjectArrayList<Flux<LLKeyScore>> results = new ObjectArrayList<>(shards.size());