mirror of https://github.com/apache/lucene.git
Clean up UnCompiledNode.inputCount (#12735)
* Clean up inputCount * Update CHANGES.txt
This commit is contained in:
parent
8400f89a91
commit
cdc7d87fcc
|
@ -62,9 +62,11 @@ API Changes
|
||||||
|
|
||||||
* GITHUB#12599: Add RandomAccessInput#readBytes method to the RandomAccessInput interface. (Ignacio Vera)
|
* GITHUB#12599: Add RandomAccessInput#readBytes method to the RandomAccessInput interface. (Ignacio Vera)
|
||||||
|
|
||||||
* GITHUB#12709 Consolidate FSTStore and BytesStore in FST. Created FSTReader which contains the common methods
|
* GITHUB#12709: Consolidate FSTStore and BytesStore in FST. Created FSTReader which contains the common methods
|
||||||
of the two (Anh Dung Bui)
|
of the two (Anh Dung Bui)
|
||||||
|
|
||||||
|
* GITHUB#12735: Remove FSTCompiler#getTermCount() and FSTCompiler.UnCompiledNode#inputCount (Anh Dung Bui)
|
||||||
|
|
||||||
New Features
|
New Features
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
|
|
|
@ -270,10 +270,6 @@ public class FSTCompiler<T> {
|
||||||
return directAddressingMaxOversizingFactor;
|
return directAddressingMaxOversizingFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTermCount() {
|
|
||||||
return frontier[0].inputCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getNodeCount() {
|
public long getNodeCount() {
|
||||||
// 1+ in order to count the -1 implicit final node
|
// 1+ in order to count the -1 implicit final node
|
||||||
return 1 + nodeCount;
|
return 1 + nodeCount;
|
||||||
|
@ -749,7 +745,6 @@ public class FSTCompiler<T> {
|
||||||
// format cannot represent the empty input since
|
// format cannot represent the empty input since
|
||||||
// 'finalness' is stored on the incoming arc, not on
|
// 'finalness' is stored on the incoming arc, not on
|
||||||
// the node
|
// the node
|
||||||
frontier[0].inputCount++;
|
|
||||||
frontier[0].isFinal = true;
|
frontier[0].isFinal = true;
|
||||||
fst.setEmptyOutput(output);
|
fst.setEmptyOutput(output);
|
||||||
return;
|
return;
|
||||||
|
@ -760,9 +755,6 @@ public class FSTCompiler<T> {
|
||||||
int pos2 = input.offset;
|
int pos2 = input.offset;
|
||||||
final int pos1Stop = Math.min(lastInput.length(), input.length);
|
final int pos1Stop = Math.min(lastInput.length(), input.length);
|
||||||
while (true) {
|
while (true) {
|
||||||
frontier[pos1].inputCount++;
|
|
||||||
// System.out.println(" incr " + pos1 + " ct=" + frontier[pos1].inputCount + " n=" +
|
|
||||||
// frontier[pos1]);
|
|
||||||
if (pos1 >= pos1Stop || lastInput.intAt(pos1) != input.ints[pos2]) {
|
if (pos1 >= pos1Stop || lastInput.intAt(pos1) != input.ints[pos2]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -786,7 +778,6 @@ public class FSTCompiler<T> {
|
||||||
// init tail states for current input
|
// init tail states for current input
|
||||||
for (int idx = prefixLenPlus1; idx <= input.length; idx++) {
|
for (int idx = prefixLenPlus1; idx <= input.length; idx++) {
|
||||||
frontier[idx - 1].addArc(input.ints[input.offset + idx - 1], frontier[idx]);
|
frontier[idx - 1].addArc(input.ints[input.offset + idx - 1], frontier[idx]);
|
||||||
frontier[idx].inputCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final UnCompiledNode<T> lastNode = frontier[input.length];
|
final UnCompiledNode<T> lastNode = frontier[input.length];
|
||||||
|
@ -835,8 +826,6 @@ public class FSTCompiler<T> {
|
||||||
|
|
||||||
// save last input
|
// save last input
|
||||||
lastInput.copyInts(input);
|
lastInput.copyInts(input);
|
||||||
|
|
||||||
// System.out.println(" count[0]=" + frontier[0].inputCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validOutput(T output) {
|
private boolean validOutput(T output) {
|
||||||
|
@ -906,10 +895,6 @@ public class FSTCompiler<T> {
|
||||||
T output;
|
T output;
|
||||||
boolean isFinal;
|
boolean isFinal;
|
||||||
|
|
||||||
// TODO: remove this tracking? we used to use it for confusingly pruning NodeHash, but
|
|
||||||
// we switched to LRU by RAM usage instead:
|
|
||||||
long inputCount;
|
|
||||||
|
|
||||||
/** This node's depth, starting from the automaton root. */
|
/** This node's depth, starting from the automaton root. */
|
||||||
final int depth;
|
final int depth;
|
||||||
|
|
||||||
|
@ -935,7 +920,6 @@ public class FSTCompiler<T> {
|
||||||
numArcs = 0;
|
numArcs = 0;
|
||||||
isFinal = false;
|
isFinal = false;
|
||||||
output = owner.NO_OUTPUT;
|
output = owner.NO_OUTPUT;
|
||||||
inputCount = 0;
|
|
||||||
|
|
||||||
// We don't clear the depth here because it never changes
|
// We don't clear the depth here because it never changes
|
||||||
// for nodes on the frontier (even when reused).
|
// for nodes on the frontier (even when reused).
|
||||||
|
|
|
@ -568,7 +568,6 @@ public class TestFSTs extends LuceneTestCase {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
((tMid - tStart) / (double) TimeUnit.SECONDS.toNanos(1)) + " sec to add all terms");
|
((tMid - tStart) / (double) TimeUnit.SECONDS.toNanos(1)) + " sec to add all terms");
|
||||||
|
|
||||||
assert fstCompiler.getTermCount() == ord;
|
|
||||||
FST<T> fst = fstCompiler.compile();
|
FST<T> fst = fstCompiler.compile();
|
||||||
long tEnd = System.nanoTime();
|
long tEnd = System.nanoTime();
|
||||||
System.out.println(
|
System.out.println(
|
||||||
|
|
Loading…
Reference in New Issue