Apache Solr open-source search software
SOLR-16617: DocSetBuilder should use DocSetUtil#smallSetSize (#1285)
Kevin Risdend4845d82af9a
diff --git a/solr/core/src/java/org/apache/solr/search/DocSetBuilder.java b/solr/core/src/java/org/apache/solr/search/DocSetBuilder.javaindex ae096b7cdc1..20a83eb25ca 100644--- a/solr/core/src/java/org/apache/solr/search/DocSetBuilder.java+++ b/solr/core/src/java/org/apache/solr/search/DocSetBuilder.java@@ -42,11 +42,7 @@ public final class DocSetBuilder {public DocSetBuilder(int maxDoc, long costEst) {this.maxDoc = maxDoc;- // For ridiculously small sets, we'll just use a sorted int[]- // maxDoc >>> 7 is a good value if you want to save memory, lower values- // such as maxDoc >>> 11 should provide faster building but at the expense- // of using a full bitset even for quite sparse data- this.threshold = (maxDoc >>> 7) + 4; // the +4 is for better testing on small indexes+ this.threshold = DocSetUtil.smallSetSize(maxDoc);if (costEst > threshold) {bitSet = new FixedBitSet(maxDoc);diff --git a/solr/core/src/java/org/apache/solr/search/DocSetUtil.java b/solr/core/src/java/org/apache/solr/search/DocSetUtil.javaindex 146ded58d22..eca19c8c0a7 100644--- a/solr/core/src/java/org/apache/solr/search/DocSetUtil.java+++ b/solr/core/src/java/org/apache/solr/search/DocSetUtil.java@@ -42,7 +42,13 @@ import org.apache.lucene.util.FixedBitSet;*/public class DocSetUtil {- /** The cut-off point for small sets (SortedIntDocSet) vs large sets (BitDocSet) */+ /**+ * The cut-off point for small sets (SortedIntDocSet) vs large sets (BitDocSet)+ *+ * <p>For ridiculously small sets, we'll just use a sorted int[]. {@code maxDoc >>> 6} is a good+ * value if you want to save memory, lower values such as {@code maxDoc >>> 11} should provide+ * faster building but at the expense of using a full bitset even for quite sparse data.+ */public static int smallSetSize(int maxDoc) {return (maxDoc >> 6) + 5; // The +5 is for better test coverage for small sets}