Skip to content

Apache Lucene open-source search software

Correct documentation in DefaultBloomFilterFactory to reflect changes in GH#11900 (#15513)

Greg Millera55be5cb368c
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 3a2c230eefc..399bd8d1a2f 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -303,6 +303,8 @@ Other
* GITHUB#15481: The `reverse` field of SortField is now final. If you have subclassed SortField,
you should set `reverse` in the super constructor. (Alan Woodward)
+* GITHUB#15513: Update documentation in DefaultBloomFilterFactory to reflect changes made in GITHUB#11900 (Greg Miller)
+
Build
---------------------
* Upgrade forbiddenapis to version 3.10. (Uwe Schindler)
diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/DefaultBloomFilterFactory.java b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/DefaultBloomFilterFactory.java
index 306fdb9b4f9..f3e07f04f43 100644
--- a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/DefaultBloomFilterFactory.java
+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/DefaultBloomFilterFactory.java
@@ -20,8 +20,8 @@ import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.SegmentWriteState;
/**
- * Default policy is to allocate a bitset with 10% saturation given a unique term per document. Bits
- * are set via MurmurHash2 hashing function.
+ * Default policy is to allocate a bitset targeting a max false-positive rate of 10%. Bits are set
+ * via MurmurHash3 hashing function.
*
* @lucene.experimental
*/
@@ -29,8 +29,10 @@ public class DefaultBloomFilterFactory extends BloomFilterFactory {
@Override
public FuzzySet getSetForField(SegmentWriteState state, FieldInfo info) {
- // Assume all of the docs have a unique term (e.g. a primary key) and we hope to maintain a set
- // with 10% of bits set
+ // Initially assume all the docs have a unique term (e.g., a primary key) and target a
+ // false-positive rate of 10%. If the "all docs have a unique term" assumptions ends up false,
+ // the underlying bitset may be downsized in a way that reduces the memory footprint while
+ // still maintaining the target max 10% false-positive probability.
return FuzzySet.createOptimalSet(state.segmentInfo.maxDoc(), 0.1023f);
}