Skip to content

Commit bc14a46

Browse files
committed
Allow passing DataOutput instead of FSTWriter
1 parent dfaaa3b commit bc14a46

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

lucene/core/src/java/org/apache/lucene/util/fst/FSTCompiler.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -249,23 +249,25 @@ public Builder<T> allowFixedLengthArcs(boolean allowFixedLengthArcs) {
249249
*
250250
* <p>Default = 15.
251251
*
252-
* @deprecated use {@link #fstWriter(FSTWriter)} instead
252+
* @deprecated use {@link #dataOutput(DataOutput)} instead
253253
*/
254254
@Deprecated
255255
public Builder<T> bytesPageBits(int bytesPageBits) {
256-
return fstWriter(new BytesStore(bytesPageBits));
256+
this.fstWriter = new BytesStore(bytesPageBits);
257+
return this;
257258
}
258259

259260
/**
260-
* Set the {@link FSTWriter} which is used for low-level writing of FST.
261+
* Set the {@link DataOutput} which is used for low-level writing of FST.
261262
*
262-
* <p>Note: Setting this will override the settings in {@link #bytesPageBits(int)}
263+
* <p>Note: Setting this will override the settings in {@link #bytesPageBits(int)} as it will
264+
* use {@link DataOutputFSTWriter}
263265
*
264-
* @param fstWriter the FSTWriter
266+
* @param dataOutput the DataOutput
265267
* @return this builder
266268
*/
267-
public Builder<T> fstWriter(FSTWriter fstWriter) {
268-
this.fstWriter = fstWriter;
269+
public Builder<T> dataOutput(DataOutput dataOutput) {
270+
this.fstWriter = new DataOutputFSTWriter(dataOutput);
269271
return this;
270272
}
271273

lucene/core/src/test/org/apache/lucene/util/fst/TestDataOutputFSTWriter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ protected FSTCompiler.Builder<T> getFSTBuilder() {
204204
// as the byte array could already contain another FST bytes, we should get the current offset
205205
// to know where to start reading from
206206
this.previousOffset = baos.size();
207-
return super.getFSTBuilder()
208-
.fstWriter(new DataOutputFSTWriter(new OutputStreamDataOutput(baos)));
207+
return super.getFSTBuilder().dataOutput(new OutputStreamDataOutput(baos));
209208
}
210209

211210
@Override

0 commit comments

Comments
 (0)