diff --git a/code/index/java/nu/marginalia/index/results/IndexResultRankingService.java b/code/index/java/nu/marginalia/index/results/IndexResultRankingService.java index f477b437..91654052 100644 --- a/code/index/java/nu/marginalia/index/results/IndexResultRankingService.java +++ b/code/index/java/nu/marginalia/index/results/IndexResultRankingService.java @@ -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 results = new ArrayList<>(resultIds.size()); diff --git a/code/index/java/nu/marginalia/index/results/model/ids/CombinedDocIdList.java b/code/index/java/nu/marginalia/index/results/model/ids/CombinedDocIdList.java index 43f5c575..45d4329f 100644 --- a/code/index/java/nu/marginalia/index/results/model/ids/CombinedDocIdList.java +++ b/code/index/java/nu/marginalia/index/results/model/ids/CombinedDocIdList.java @@ -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() {