Skip to content

Commit 193d8f1

Browse files
dungba88mikemccand
authored andcommitted
Allow FST builder to use different writer (#12543) (#12624)
* Move size() to FSTStore * Remove size() completely * Allow FST builder to use different DataOutput * access BytesStore byte[] directly for copying * Rename BytesStore * Change class to final * Reorder methods * Remove unused methods * Rename truncate to setPosition() and remove skipBytes() * Simplify the writing operations * Update comment * remove unused parameter * Simplify BytesStore operation * tidy code * Rename copyBytes to writeTo * Simplify BytesStore operations * Embed writeBytes() to FSTCompiler * Fix the write bytes method * Remove the default block bits constant * add assertion * Rename method parameter names * Move reverse to FSTCompiler * Revert setPosition call * Address comments * Return immediately when writing 0 bytes * Add comment & * Rename variables * Fix the compile error * Remove isReadable() * Remove isReadable() * Optimize ReadWriteDataOutput * tidy code * Freeze the DataOutput once finished() * Refactor * freeze the DataOutput before use * Address comments and add off-heap FST tests * Remove the hardcoded random * Ignore the Test2BFSTOffHeap test * Simplify ReadWriteDataOutput * Update Javadoc * Address comments
1 parent 03b6c08 commit 193d8f1

File tree

15 files changed

+928
-945
lines changed

15 files changed

+928
-945
lines changed

lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/Lucene90BlockTreeTermsWriter.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*/
1717
package org.apache.lucene.codecs.lucene90.blocktree;
1818

19+
import static org.apache.lucene.util.fst.FSTCompiler.getOnHeapReaderWriter;
20+
1921
import java.io.IOException;
2022
import java.util.ArrayList;
2123
import java.util.Arrays;
@@ -521,7 +523,12 @@ public void compileIndex(
521523

522524
final ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton();
523525
final FSTCompiler<BytesRef> fstCompiler =
524-
new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs).bytesPageBits(pageBits).build();
526+
new FSTCompiler.Builder<>(FST.INPUT_TYPE.BYTE1, outputs)
527+
// Disable suffixes sharing for block tree index because suffixes are mostly dropped
528+
// from the FST index and left in the term blocks.
529+
.suffixRAMLimitMB(0d)
530+
.dataOutput(getOnHeapReaderWriter(pageBits))
531+
.build();
525532
// if (DEBUG) {
526533
// System.out.println(" compile index for prefix=" + prefix);
527534
// }

0 commit comments

Comments
 (0)