You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by vo...@apache.org on 2026/02/19 09:12:40 UTC

(lucene) branch main updated: Updated MIGRATE.md for CFS threshold API changes (#15691)

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

voditas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 9c427a31717 Updated MIGRATE.md for CFS threshold API changes (#15691)
9c427a31717 is described below

commit 9c427a31717098c64e6fa5a12480bd7739151677
Author: Shubham Sharma <sh...@gmail.com>
AuthorDate: Thu Feb 19 09:12:34 2026 +0000

    Updated MIGRATE.md for CFS threshold API changes (#15691)
---
 lucene/MIGRATE.md | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/lucene/MIGRATE.md b/lucene/MIGRATE.md
index 2c5444befea..14b799c4184 100644
--- a/lucene/MIGRATE.md
+++ b/lucene/MIGRATE.md
@@ -120,6 +120,45 @@ Missing values should be configured in SortField constructor methods, as they ar
 MatchAllDocs and MatchNoDocs queries should use the INSTANCE final field instead of creating
 new objects. The constructors will be removed in the future.
 
+### APIs for configuring compound file creation thresholds have been updated and moved
+
+APIs for configuring compound file creation thresholds were part of merge policies before.
+They are now part of `CompoundFormat`. Previously, the compound file creation depended upon the size of the merged
+segment with respect to the total index size (determined by `CFSRatio` which was 10% by default). Lucene now uses fixed
+thresholds to decide whether a merged segment should be written as a compound file, the default thresholds are:
+
+- **64 MB** for size-based merge policies (e.g., `TieredMergePolicy`)
+- **65,536 documents** for document-count based merge policies (e.g., `LogDocMergePolicy`)
+
+These thresholds could be changed using `setCfsThresholdByteSize` and `setCfsThresholdDocSize` respectively.
+
+#### Migration
+
+If your code previously configured `getNoCFSRatio`, `getMaxCFSSegmentSizeMB`, `setMaxCFSSegmentSizeMB` and `setNoCFSRatio`
+on merge policies, you should change it as follows:
+
+##### Before
+
+```java
+TieredMergePolicy mp = new TieredMergePolicy();
+mp.setNoCFSRatio(0.0);
+mp.setMaxCFSSegmentSizeMB(512);
+IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
+iwc.setMergePolicy(mp);
+mp.getNoCFSRatio();
+mp.getMaxCFSSegmentSizeMB();
+```
+
+##### After
+
+```java
+IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
+iwc.getConfig().getCodec().compoundFormat().setShouldUseCompoundFile(false);
+iwc.getConfig().getCodec().compoundFormat().setMaxCFSSegmentSizeMB(512);
+iwc.getConfig().getCodec().compoundFormat().getShouldUseCompoundFile();
+iwc.getConfig().getCodec().compoundFormat().getMaxCFSSegmentSizeMB();
+```
+
 ## Migration from Lucene 9.x to Lucene 10.0
 
 ### DataInput#readVLong() may now read negative vlongs