mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 04:58:59 +00:00
(index) Short-circuit rankResults when there are no results
This commit is contained in:
parent
89f7f3c17c
commit
6460c11107
@ -54,6 +54,9 @@ public class IndexResultRankingService {
|
||||
ResultRankingContext rankingContext,
|
||||
CombinedDocIdList resultIds)
|
||||
{
|
||||
if (resultIds.isEmpty())
|
||||
return List.of();
|
||||
|
||||
IndexResultScoreCalculator resultRanker = new IndexResultScoreCalculator(statefulIndex, rankingContext, params);
|
||||
|
||||
List<SearchResultItem> results = new ArrayList<>(resultIds.size());
|
||||
|
@ -1,7 +1,6 @@
|
||||
package nu.marginalia.index.results.model.ids;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.LongArrayList;
|
||||
import it.unimi.dsi.fastutil.longs.LongIterators;
|
||||
import org.roaringbitmap.longlong.Roaring64Bitmap;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -32,6 +31,9 @@ public final class CombinedDocIdList {
|
||||
public int size() {
|
||||
return data.length;
|
||||
}
|
||||
public boolean isEmpty() {
|
||||
return data.length == 0;
|
||||
}
|
||||
public long at(int i) { return data[i]; }
|
||||
|
||||
public LongStream stream() {
|
||||
|
Loading…
Reference in New Issue
Block a user