Don't parallelize here
This commit is contained in:
parent
36dde3bb5a
commit
9e09574517
@ -371,17 +371,13 @@ public class LuceneUtils {
|
||||
|
||||
return hits.transform(hitsFlux -> {
|
||||
if (preserveOrder) {
|
||||
return hitsFlux.flatMapSequential(hit -> Mono
|
||||
.fromCallable(() -> mapHitBlocking(hit, indexSearchers, keyFieldName))
|
||||
.subscribeOn(scheduler),
|
||||
3
|
||||
);
|
||||
return hitsFlux
|
||||
.publishOn(scheduler)
|
||||
.mapNotNull(hit -> mapHitBlocking(hit, indexSearchers, keyFieldName));
|
||||
} else {
|
||||
return hitsFlux.flatMap(hit -> Mono
|
||||
.fromCallable(() -> mapHitBlocking(hit, indexSearchers, keyFieldName))
|
||||
.subscribeOn(scheduler),
|
||||
3
|
||||
);
|
||||
return hitsFlux
|
||||
.publishOn(scheduler)
|
||||
.mapNotNull(hit -> mapHitBlocking(hit, indexSearchers, keyFieldName));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import it.cavallium.dbengine.lucene.LuceneUtils;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -150,8 +151,9 @@ class ScoredSimpleLuceneShardSearcher implements LuceneShardSearcher {
|
||||
return flux;
|
||||
}
|
||||
})
|
||||
.flatMapSequential(topFieldDoc -> LuceneUtils.convertHits(Flux.fromArray(topFieldDoc.scoreDocs),
|
||||
indexSearchers, keyFieldName, collectorScheduler, true), 3);
|
||||
.flatMapIterable(topFieldDoc -> Arrays.asList(topFieldDoc.scoreDocs))
|
||||
.transform(scoreDocs -> LuceneUtils.convertHits(scoreDocs,
|
||||
indexSearchers, keyFieldName, collectorScheduler, true));
|
||||
|
||||
return new LuceneSearchResult(LuceneUtils.convertTotalHitsCount(result.totalHits),
|
||||
firstPageHits
|
||||
|
Loading…
Reference in New Issue
Block a user