Skip to content

Commit ed265da

Browse files
committed
Make FSTCompiler return just the metadata
1 parent f8a6fe7 commit ed265da

File tree

34 files changed

+115
-66
lines changed

34 files changed

+115
-66
lines changed

lucene/analysis/common/src/java/org/apache/lucene/analysis/charfilter/NormalizeCharMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public NormalizeCharMap build() {
111111
for (Map.Entry<String, String> ent : pendingPairs.entrySet()) {
112112
fstCompiler.add(Util.toUTF16(ent.getKey(), scratch), new CharsRef(ent.getValue()));
113113
}
114-
map = fstCompiler.compile();
114+
map = FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
115115
pendingPairs.clear();
116116
} catch (IOException ioe) {
117117
// Bogus FST IOExceptions!! (will never happen)

lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/ConvTable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class ConvTable {
5151
fstCompiler.add(scratchInts.get(), new CharsRef(entry.getValue()));
5252
}
5353

54-
fst = fstCompiler.compile();
54+
fst = FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
5555
} catch (IOException bogus) {
5656
throw new RuntimeException(bogus);
5757
}

lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/Dictionary.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ private FST<IntsRef> affixFST(TreeMap<String, List<Integer>> affixes) throws IOE
644644
}
645645
fstCompiler.add(scratch.get(), output);
646646
}
647-
return fstCompiler.compile();
647+
return FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
648648
}
649649

650650
/**

lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/StemmerOverrideFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ public StemmerOverrideMap build() throws IOException {
222222
intsSpare.copyUTF8Bytes(bytesRef);
223223
fstCompiler.add(intsSpare.get(), new BytesRef(outputValues.get(id)));
224224
}
225-
return new StemmerOverrideMap(fstCompiler.compile(), ignoreCase);
225+
return new StemmerOverrideMap(
226+
FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader()), ignoreCase);
226227
}
227228
}
228229
}

lucene/analysis/common/src/java/org/apache/lucene/analysis/synonym/SynonymMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ public SynonymMap build() throws IOException {
291291
fstCompiler.add(Util.toUTF32(input, scratchIntsRef), scratch.toBytesRef());
292292
}
293293

294-
FST<BytesRef> fst = fstCompiler.compile();
294+
FST<BytesRef> fst = FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
295295
return new SynonymMap(fst, words, maxHorizontalContext);
296296
}
297297
}

lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/TokenInfoDictionaryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ private TokenInfoDictionaryWriter buildDictionary(List<Path> csvFiles) throws IO
130130
dictionary.addMapping((int) ord, offset);
131131
offset = next;
132132
}
133-
dictionary.setFST(fstCompiler.compile());
133+
dictionary.setFST(FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader()));
134134
return dictionary;
135135
}
136136

lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/UserDictionary.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public int compare(String[] left, String[] right) {
147147
segmentations.add(wordIdAndLength);
148148
ord++;
149149
}
150-
this.fst = new TokenInfoFST(fstCompiler.compile(), false);
150+
this.fst =
151+
new TokenInfoFST(
152+
FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader()), false);
151153
this.morphAtts = new UserMorphData(data.toArray(new String[0]));
152154
this.segmentations = segmentations.toArray(new int[segmentations.size()][]);
153155
}

lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/dict/TokenInfoDictionaryBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private TokenInfoDictionaryWriter buildDictionary(List<Path> csvFiles) throws IO
126126
dictionary.addMapping((int) ord, offset);
127127
offset = next;
128128
}
129-
dictionary.setFST(fstCompiler.compile());
129+
dictionary.setFST(FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader()));
130130
return dictionary;
131131
}
132132
}

lucene/analysis/nori/src/java/org/apache/lucene/analysis/ko/dict/UserDictionary.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ private UserDictionary(List<String> entries) throws IOException {
130130
lastToken = token;
131131
ord++;
132132
}
133-
this.fst = new TokenInfoFST(fstCompiler.compile());
133+
this.fst =
134+
new TokenInfoFST(FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader()));
134135
int[][] segmentations = _segmentations.toArray(new int[_segmentations.size()][]);
135136
short[] rightIds = new short[_rightIds.size()];
136137
for (int i = 0; i < _rightIds.size(); i++) {

lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene40/blocktree/Lucene40BlockTreeTermsWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ public void compileIndex(
498498
}
499499
}
500500

501-
index = fstCompiler.compile();
501+
index = FST.fromFSTReader(fstCompiler.compile(), fstCompiler.getFSTReader());
502502

503503
assert subIndices == null;
504504

0 commit comments

Comments
 (0)