Skip to content

Commit c811786

Browse files
dungba88mikemccand
authored andcommitted
Clean up UnCompiledNode.inputCount (#12735)
* Clean up inputCount * Update CHANGES.txt
1 parent d020359 commit c811786

File tree

3 files changed

+2
-17
lines changed

3 files changed

+2
-17
lines changed

lucene/CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ API Changes
3535
* GITHUB#12709 Consolidate FSTStore and BytesStore in FST. Created FSTReader which contains the common methods
3636
of the two (Anh Dung Bui)
3737

38+
* GITHUB#12735: Remove FSTCompiler#getTermCount() and FSTCompiler.UnCompiledNode#inputCount (Anh Dung Bui)
39+
3840
New Features
3941
---------------------
4042

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ public float getDirectAddressingMaxOversizingFactor() {
270270
return directAddressingMaxOversizingFactor;
271271
}
272272

273-
public long getTermCount() {
274-
return frontier[0].inputCount;
275-
}
276-
277273
public long getNodeCount() {
278274
// 1+ in order to count the -1 implicit final node
279275
return 1 + nodeCount;
@@ -749,7 +745,6 @@ public void add(IntsRef input, T output) throws IOException {
749745
// format cannot represent the empty input since
750746
// 'finalness' is stored on the incoming arc, not on
751747
// the node
752-
frontier[0].inputCount++;
753748
frontier[0].isFinal = true;
754749
fst.setEmptyOutput(output);
755750
return;
@@ -760,9 +755,6 @@ public void add(IntsRef input, T output) throws IOException {
760755
int pos2 = input.offset;
761756
final int pos1Stop = Math.min(lastInput.length(), input.length);
762757
while (true) {
763-
frontier[pos1].inputCount++;
764-
// System.out.println(" incr " + pos1 + " ct=" + frontier[pos1].inputCount + " n=" +
765-
// frontier[pos1]);
766758
if (pos1 >= pos1Stop || lastInput.intAt(pos1) != input.ints[pos2]) {
767759
break;
768760
}
@@ -786,7 +778,6 @@ public void add(IntsRef input, T output) throws IOException {
786778
// init tail states for current input
787779
for (int idx = prefixLenPlus1; idx <= input.length; idx++) {
788780
frontier[idx - 1].addArc(input.ints[input.offset + idx - 1], frontier[idx]);
789-
frontier[idx].inputCount++;
790781
}
791782

792783
final UnCompiledNode<T> lastNode = frontier[input.length];
@@ -835,8 +826,6 @@ public void add(IntsRef input, T output) throws IOException {
835826

836827
// save last input
837828
lastInput.copyInts(input);
838-
839-
// System.out.println(" count[0]=" + frontier[0].inputCount);
840829
}
841830

842831
private boolean validOutput(T output) {
@@ -906,10 +895,6 @@ static final class UnCompiledNode<T> implements Node {
906895
T output;
907896
boolean isFinal;
908897

909-
// TODO: remove this tracking? we used to use it for confusingly pruning NodeHash, but
910-
// we switched to LRU by RAM usage instead:
911-
long inputCount;
912-
913898
/** This node's depth, starting from the automaton root. */
914899
final int depth;
915900

@@ -935,7 +920,6 @@ void clear() {
935920
numArcs = 0;
936921
isFinal = false;
937922
output = owner.NO_OUTPUT;
938-
inputCount = 0;
939923

940924
// We don't clear the depth here because it never changes
941925
// for nodes on the frontier (even when reused).

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ public void run(int limit, boolean verify) throws IOException {
568568
System.out.println(
569569
((tMid - tStart) / (double) TimeUnit.SECONDS.toNanos(1)) + " sec to add all terms");
570570

571-
assert fstCompiler.getTermCount() == ord;
572571
FST<T> fst = fstCompiler.compile();
573572
long tEnd = System.nanoTime();
574573
System.out.println(

0 commit comments

Comments
 (0)