You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2014/05/15 23:25:41 UTC
svn commit: r1595052 - in
/lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree:
BlockTreeTermsReader.java IntersectTermsEnum.java SegmentTermsEnum.java
Author: mikemccand
Date: Thu May 15 21:25:41 2014
New Revision: 1595052
URL: http://svn.apache.org/r1595052
Log:
LUCENE-5675: small cleanups
Modified:
lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java
lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java
lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java
Modified: lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java?rev=1595052&r1=1595051&r2=1595052&view=diff
==============================================================================
--- lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java (original)
+++ lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsReader.java Thu May 15 21:25:41 2014
@@ -291,9 +291,6 @@ public class BlockTreeTermsReader extend
}
}
- final Outputs<BytesRef> fstOutputs = ByteSequenceOutputs.getSingleton();
- final BytesRef NO_OUTPUT = fstOutputs.getNoOutput();
-
@Override
public long ramBytesUsed() {
long sizeInByes = ((postingsReader!=null) ? postingsReader.ramBytesUsed() : 0);
Modified: lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java?rev=1595052&r1=1595051&r2=1595052&view=diff
==============================================================================
--- lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java (original)
+++ lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/IntersectTermsEnum.java Thu May 15 21:25:41 2014
@@ -32,11 +32,14 @@ import org.apache.lucene.util.RamUsageEs
import org.apache.lucene.util.StringHelper;
import org.apache.lucene.util.automaton.CompiledAutomaton;
import org.apache.lucene.util.automaton.RunAutomaton;
+import org.apache.lucene.util.fst.ByteSequenceOutputs;
import org.apache.lucene.util.fst.FST;
+import org.apache.lucene.util.fst.Outputs;
// NOTE: cannot seek!
final class IntersectTermsEnum extends TermsEnum {
final IndexInput in;
+ final static Outputs<BytesRef> fstOutputs = ByteSequenceOutputs.getSingleton();
private IntersectTermsEnumFrame[] stack;
@@ -169,14 +172,14 @@ final class IntersectTermsEnum extends T
// passed to findTargetArc
arc = fr.index.findTargetArc(target, arc, getArc(1+idx), fstReader);
assert arc != null;
- output = fr.parent.fstOutputs.add(output, arc.output);
+ output = fstOutputs.add(output, arc.output);
idx++;
}
f.arc = arc;
f.outputPrefix = output;
assert arc.isFinal();
- f.load(fr.parent.fstOutputs.add(output, arc.nextFinalOutput));
+ f.load(fstOutputs.add(output, arc.nextFinalOutput));
return f;
}
Modified: lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java?rev=1595052&r1=1595051&r2=1595052&view=diff
==============================================================================
--- lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java (original)
+++ lucene/dev/branches/lucene5675/lucene/core/src/java/org/apache/lucene/codecs/blocktree/SegmentTermsEnum.java Thu May 15 21:25:41 2014
@@ -32,12 +32,17 @@ import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.RamUsageEstimator;
+import org.apache.lucene.util.fst.ByteSequenceOutputs;
import org.apache.lucene.util.fst.FST;
+import org.apache.lucene.util.fst.Outputs;
import org.apache.lucene.util.fst.Util;
/** Iterates through terms in this field */
final class SegmentTermsEnum extends TermsEnum {
+ final static Outputs<BytesRef> fstOutputs = ByteSequenceOutputs.getSingleton();
+ final static BytesRef NO_OUTPUT = fstOutputs.getNoOutput();
+
// Lazy init:
IndexInput in;
@@ -361,8 +366,8 @@ final class SegmentTermsEnum extends Ter
//System.out.println("FAIL: arc.label=" + (char) arc.label + " targetLabel=" + (char) (target.bytes[target.offset + targetUpto] & 0xFF));
//}
assert arc.label == (target.bytes[target.offset + targetUpto] & 0xFF): "arc.label=" + (char) arc.label + " targetLabel=" + (char) (target.bytes[target.offset + targetUpto] & 0xFF);
- if (arc.output != fr.parent.NO_OUTPUT) {
- output = fr.parent.fstOutputs.add(output, arc.output);
+ if (arc.output != NO_OUTPUT) {
+ output = fstOutputs.add(output, arc.output);
}
if (arc.isFinal()) {
lastFrame = stack[1+lastFrame.ord];
@@ -452,7 +457,7 @@ final class SegmentTermsEnum extends Ter
//term.length = 0;
targetUpto = 0;
- currentFrame = pushFrame(arc, fr.parent.fstOutputs.add(output, arc.nextFinalOutput), 0);
+ currentFrame = pushFrame(arc, fstOutputs.add(output, arc.nextFinalOutput), 0);
}
// if (DEBUG) {
@@ -507,8 +512,8 @@ final class SegmentTermsEnum extends Ter
term.bytes[targetUpto] = (byte) targetLabel;
// Aggregate output as we go:
assert arc.output != null;
- if (arc.output != fr.parent.NO_OUTPUT) {
- output = fr.parent.fstOutputs.add(output, arc.output);
+ if (arc.output != NO_OUTPUT) {
+ output = fstOutputs.add(output, arc.output);
}
// if (DEBUG) {
@@ -518,7 +523,7 @@ final class SegmentTermsEnum extends Ter
if (arc.isFinal()) {
//if (DEBUG) System.out.println(" arc is final!");
- currentFrame = pushFrame(arc, fr.parent.fstOutputs.add(output, arc.nextFinalOutput), targetUpto);
+ currentFrame = pushFrame(arc, fstOutputs.add(output, arc.nextFinalOutput), targetUpto);
//if (DEBUG) System.out.println(" curFrame.ord=" + currentFrame.ord + " hasTerms=" + currentFrame.hasTerms);
}
}
@@ -623,8 +628,8 @@ final class SegmentTermsEnum extends Ter
// seek; but, often the FST doesn't have any
// shared bytes (but this could change if we
// reverse vLong byte order)
- if (arc.output != fr.parent.NO_OUTPUT) {
- output = fr.parent.fstOutputs.add(output, arc.output);
+ if (arc.output != NO_OUTPUT) {
+ output = fstOutputs.add(output, arc.output);
}
if (arc.isFinal()) {
lastFrame = stack[1+lastFrame.ord];
@@ -709,7 +714,7 @@ final class SegmentTermsEnum extends Ter
//term.length = 0;
targetUpto = 0;
- currentFrame = pushFrame(arc, fr.parent.fstOutputs.add(output, arc.nextFinalOutput), 0);
+ currentFrame = pushFrame(arc, fstOutputs.add(output, arc.nextFinalOutput), 0);
}
//if (DEBUG) {
@@ -764,8 +769,8 @@ final class SegmentTermsEnum extends Ter
arc = nextArc;
// Aggregate output as we go:
assert arc.output != null;
- if (arc.output != fr.parent.NO_OUTPUT) {
- output = fr.parent.fstOutputs.add(output, arc.output);
+ if (arc.output != NO_OUTPUT) {
+ output = fstOutputs.add(output, arc.output);
}
//if (DEBUG) {
@@ -775,7 +780,7 @@ final class SegmentTermsEnum extends Ter
if (arc.isFinal()) {
//if (DEBUG) System.out.println(" arc is final!");
- currentFrame = pushFrame(arc, fr.parent.fstOutputs.add(output, arc.nextFinalOutput), targetUpto);
+ currentFrame = pushFrame(arc, fstOutputs.add(output, arc.nextFinalOutput), targetUpto);
//if (DEBUG) System.out.println(" curFrame.ord=" + currentFrame.ord + " hasTerms=" + currentFrame.hasTerms);
}
}