Apache Lucene open-source search software
Fix FuzzySet#createSetBasedOnMaxMemory to honor bytes not bits (#14616)
Greg Miller39a7f704d680
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex 574a16725b1..d4555e7a641 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -311,6 +311,8 @@ Bug Fixes* GITHUB#15523: Updating createMultiSegmentIndex to utilize an explicit NoMergePolicy (Bryce Kane)+* GITHUB#14616 : Fix mis-interpretation of `maxNumBytes` in FuzzySet#createSetBasedOnMaxMemory (Greg Miller)+Other---------------------* GITHUB#15237: Fix SmartChinese to only deserialize dictionary data from classpath with a native arraydiff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/FuzzySet.java b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/FuzzySet.javaindex 85311c2c313..60e5aa6b7fb 100644--- a/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/FuzzySet.java+++ b/lucene/codecs/src/java/org/apache/lucene/codecs/bloom/FuzzySet.java@@ -89,7 +89,7 @@ public class FuzzySet implements Accountable {}public static FuzzySet createSetBasedOnMaxMemory(int maxNumBytes) {- int setSize = getNearestSetSize(maxNumBytes);+ int setSize = getNearestSetSize(maxNumBytes * Byte.SIZE);return new FuzzySet(new FixedBitSet(setSize + 1), setSize, 1);}