You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2023/01/11 05:36:50 UTC

[solr] branch branch_9x updated: SOLR-16617: DocSetBuilder should use DocSetUtil#smallSetSize (#1285)

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new d143545837d SOLR-16617: DocSetBuilder should use DocSetUtil#smallSetSize (#1285)
d143545837d is described below

commit d143545837d1fd6285a418056361c11f2401050e
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Wed Jan 11 00:33:18 2023 -0500

    SOLR-16617: DocSetBuilder should use DocSetUtil#smallSetSize (#1285)
---
 solr/core/src/java/org/apache/solr/search/DocSetBuilder.java | 6 +-----
 solr/core/src/java/org/apache/solr/search/DocSetUtil.java    | 8 +++++++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/search/DocSetBuilder.java b/solr/core/src/java/org/apache/solr/search/DocSetBuilder.java
index 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.java
index 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
   }