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