mirror of https://github.com/apache/lucene.git
LUCENE-5752: minor cleanups / remove imports / sops, etc.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5752@1603116 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a135294eda
commit
cc3eaed1bc
|
@ -105,7 +105,7 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
return field.hashCode() * 31 + term.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// private String segment;
|
||||
|
||||
public BlockTermsReader(TermsIndexReaderBase indexReader, Directory dir, FieldInfos fieldInfos, SegmentInfo info, PostingsReaderBase postingsReader, IOContext context,
|
||||
|
@ -364,7 +364,7 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
throw new IllegalStateException("terms index was not loaded");
|
||||
}
|
||||
|
||||
//System.out.println("BTR.seek seg=" + segment + " target=" + fieldInfo.name + ":" + target.utf8ToString() + " " + target + " current=" + term().utf8ToString() + " " + term() + " indexIsCurrent=" + indexIsCurrent + " didIndexNext=" + didIndexNext + " seekPending=" + seekPending + " this=" + this);
|
||||
//System.out.println("BTR.seek seg=" + segment + " target=" + fieldInfo.name + ":" + target.utf8ToString() + " " + target + " current=" + term().utf8ToString() + " " + term() + " indexIsCurrent=" + indexIsCurrent + " didIndexNext=" + didIndexNext + " seekPending=" + seekPending + " divisor=" + indexReader.getDivisor() + " this=" + this);
|
||||
if (didIndexNext) {
|
||||
if (nextIndexTerm == null) {
|
||||
//System.out.println(" nextIndexTerm=null");
|
||||
|
@ -450,7 +450,6 @@ public class BlockTermsReader extends FieldsProducer {
|
|||
// do we then copy the bytes into the term.
|
||||
|
||||
while(true) {
|
||||
//System.out.println("cycle common=" + common + " termBlockPrefix=" + termBlockPrefix + " term=" + term + " target=" + target);
|
||||
|
||||
// First, see if target term matches common prefix
|
||||
// in this block:
|
||||
|
|
|
@ -46,7 +46,6 @@ import org.apache.lucene.util.Bits;
|
|||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.apache.lucene.util.automaton.RunAutomaton;
|
||||
import org.apache.lucene.util.automaton.Transition;
|
||||
|
||||
|
|
|
@ -981,9 +981,8 @@
|
|||
<!-- Restrict access to certain Java features and install security manager: -->
|
||||
<sysproperty key="junit4.tempDir" file="@{workDir}/temp" />
|
||||
<sysproperty key="clover.db.dir" file="${clover.db.dir}" />
|
||||
<!-- nocommit -->
|
||||
<!--<sysproperty key="java.security.manager" value="org.apache.lucene.util.TestSecurityManager" />
|
||||
<sysproperty key="java.security.policy" file="${common.dir}/tools/junit4/tests.policy" />-->
|
||||
<sysproperty key="java.security.manager" value="org.apache.lucene.util.TestSecurityManager" />
|
||||
<sysproperty key="java.security.policy" file="${common.dir}/tools/junit4/tests.policy" />
|
||||
|
||||
<sysproperty key="lucene.version" value="${version}"/>
|
||||
|
||||
|
|
|
@ -18,42 +18,25 @@ package org.apache.lucene.codecs.blocktree;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.lucene.codecs.BlockTermState;
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.FieldsProducer;
|
||||
import org.apache.lucene.codecs.PostingsReaderBase;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
import org.apache.lucene.index.DocsEnum;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentInfo;
|
||||
import org.apache.lucene.index.TermState;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.store.ByteArrayDataInput;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
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;
|
||||
import org.apache.lucene.util.fst.Util;
|
||||
|
||||
/** A block-based terms index and dictionary that assigns
|
||||
* terms to variable length blocks according to how they
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.lucene.index.FieldInfo.IndexOptions;
|
|||
import org.apache.lucene.store.ByteArrayDataInput;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.apache.lucene.util.automaton.Transition;
|
||||
import org.apache.lucene.util.fst.FST;
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.apache.lucene.index.Terms;
|
|||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.util.AttributeSource;
|
||||
import org.apache.lucene.util.ToStringUtils;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
|
||||
/**
|
||||
* A {@link Query} that will match terms against a finite-state machine.
|
||||
|
@ -116,7 +116,7 @@ public class AutomatonQuery extends MultiTermQuery {
|
|||
return buffer.toString();
|
||||
}
|
||||
|
||||
/** Returns the light automaton used to create this query */
|
||||
/** Returns the automaton used to create this query */
|
||||
public Automaton getAutomaton() {
|
||||
return automaton;
|
||||
}
|
||||
|
|
|
@ -35,10 +35,10 @@ import org.apache.lucene.util.AttributeSource;
|
|||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.UnicodeUtil;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.apache.lucene.util.automaton.ByteRunAutomaton;
|
||||
import org.apache.lucene.util.automaton.CompiledAutomaton;
|
||||
import org.apache.lucene.util.automaton.LevenshteinAutomata;
|
||||
import org.apache.lucene.util.automaton.Automaton;
|
||||
|
||||
/** Subclass of TermsEnum for enumerating all terms that are similar
|
||||
* to the specified filter term.
|
||||
|
|
|
@ -122,28 +122,20 @@ public abstract class RunAutomaton {
|
|||
*/
|
||||
public RunAutomaton(Automaton a, int maxInterval, boolean tableize) {
|
||||
this.maxInterval = maxInterval;
|
||||
//System.out.println("before det a=" + a.getNumStates());
|
||||
a = Operations.determinize(a);
|
||||
this.automaton = a;
|
||||
//System.out.println("AFTER DET tableize= " + tableize + ": ");
|
||||
//System.out.println(a.toDot());
|
||||
points = a.getStartPoints();
|
||||
//System.out.println(" points=" + Arrays.toString(points));
|
||||
initial = 0;
|
||||
size = Math.max(1,a.getNumStates());
|
||||
accept = new boolean[size];
|
||||
transitions = new int[size * points.length];
|
||||
Arrays.fill(transitions, -1);
|
||||
//System.out.println("RA: size=" + size + " points.length=" + points.length + " total=" + (size * points.length));
|
||||
for (int n=0;n<size;n++) {
|
||||
accept[n] = a.isAccept(n);
|
||||
//System.out.println("n=" + n + " acc=" + accept[n] + " size=" + size);
|
||||
for (int c = 0; c < points.length; c++) {
|
||||
int dest = a.step(n, points[c]);
|
||||
//System.out.println(" step from point=" + c + " n=" + n + " label=" + (char) points[c] + " -> " + dest);
|
||||
assert dest == -1 || dest < size;
|
||||
transitions[n * points.length + c] = dest;
|
||||
//System.out.println(" trans label=" + points[c] + " dest=" + transitions[n * points.length + c]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,9 +150,7 @@ public abstract class RunAutomaton {
|
|||
i++;
|
||||
}
|
||||
classmap[j] = i;
|
||||
//System.out.println("classmap[" + (char) j + "]=" + i);
|
||||
}
|
||||
//System.out.println(" after classmap i=" + i + " maxInterval=" + maxInterval);
|
||||
} else {
|
||||
classmap = null;
|
||||
}
|
||||
|
@ -174,11 +164,9 @@ public abstract class RunAutomaton {
|
|||
* transition function.)
|
||||
*/
|
||||
public final int step(int state, int c) {
|
||||
//System.out.println(" step state=" + state + " c=" + c + " points.length=" + points.length + " transitions.len=" + transitions.length);
|
||||
if (classmap == null) {
|
||||
return transitions[state * points.length + getCharClass(c)];
|
||||
} else {
|
||||
//System.out.println(" classmap[c]=" + classmap[c]);
|
||||
return transitions[state * points.length + classmap[c]];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,10 @@ package org.apache.lucene.util.automaton;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/** Used temporarily when iterating through transitions from a {@link Automaton}
|
||||
/** Holds one transition from an {@link Automaton}. This is typically
|
||||
* used temporarily when iterating through transitions by invoking
|
||||
* {@link Automaton#initTransition} and {@link Automaton#getNextTransition}. */
|
||||
|
||||
public class Transition {
|
||||
|
||||
/** Sole constructor. */
|
||||
|
|
|
@ -134,8 +134,6 @@ public final class UTF32ToUTF8 {
|
|||
void convertOneEdge(int start, int end, int startCodePoint, int endCodePoint) {
|
||||
startUTF8.set(startCodePoint);
|
||||
endUTF8.set(endCodePoint);
|
||||
//System.out.println("start = " + startUTF8);
|
||||
//System.out.println(" end = " + endUTF8);
|
||||
build(start, end, startUTF8, endUTF8, 0);
|
||||
}
|
||||
|
||||
|
@ -294,15 +292,12 @@ public final class UTF32ToUTF8 {
|
|||
|
||||
int numTransitions = utf32.getNumTransitions(utf32State);
|
||||
utf32.initTransition(utf32State, scratch);
|
||||
//System.out.println(" convert state=" + utf32State + " numTransitions=" + numTransitions);
|
||||
for(int i=0;i<numTransitions;i++) {
|
||||
utf32.getNextTransition(scratch);
|
||||
int destUTF32 = scratch.dest;
|
||||
int destUTF8 = map[destUTF32];
|
||||
//System.out.println(" transition min=" + scratch.min + " max=" + scratch.max);
|
||||
if (destUTF8 == -1) {
|
||||
destUTF8 = utf8.createState();
|
||||
//System.out.println(" create dest=" + destUTF8 +" accept=" + utf32.isAccept(destUTF32));
|
||||
utf8.setAccept(destUTF8, utf32.isAccept(destUTF32));
|
||||
map[destUTF32] = destUTF8;
|
||||
pending.add(destUTF32);
|
||||
|
|
|
@ -18,44 +18,25 @@ package org.apache.lucene.codecs.idversion;
|
|||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.apache.lucene.codecs.BlockTermState;
|
||||
import org.apache.lucene.codecs.CodecUtil;
|
||||
import org.apache.lucene.codecs.FieldsProducer;
|
||||
import org.apache.lucene.codecs.PostingsReaderBase;
|
||||
import org.apache.lucene.index.CorruptIndexException;
|
||||
import org.apache.lucene.index.DocsAndPositionsEnum;
|
||||
import org.apache.lucene.index.DocsEnum;
|
||||
import org.apache.lucene.index.FieldInfo.IndexOptions;
|
||||
import org.apache.lucene.index.FieldInfo;
|
||||
import org.apache.lucene.index.FieldInfos;
|
||||
import org.apache.lucene.index.IndexFileNames;
|
||||
import org.apache.lucene.index.SegmentInfo;
|
||||
import org.apache.lucene.index.TermState;
|
||||
import org.apache.lucene.index.Terms;
|
||||
import org.apache.lucene.index.TermsEnum;
|
||||
import org.apache.lucene.store.ByteArrayDataInput;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.IOContext;
|
||||
import org.apache.lucene.store.IndexInput;
|
||||
import org.apache.lucene.util.ArrayUtil;
|
||||
import org.apache.lucene.util.Bits;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.IOUtils;
|
||||
import org.apache.lucene.util.RamUsageEstimator;
|
||||
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;
|
||||
import org.apache.lucene.util.fst.PairOutputs.Pair;
|
||||
import org.apache.lucene.util.fst.PairOutputs;
|
||||
import org.apache.lucene.util.fst.Util;
|
||||
|
||||
/**
|
||||
* See {@link VersionBlockTreeTermsWriter}.
|
||||
|
|
|
@ -129,7 +129,7 @@ public class AutomatonTestUtil {
|
|||
|
||||
/**
|
||||
* Lets you retrieve random strings accepted
|
||||
* by a LightAutomaton.
|
||||
* by an Automaton.
|
||||
* <p>
|
||||
* Once created, call {@link #getRandomAcceptedString(Random)}
|
||||
* to get a new string (in UTF-32 codepoints).
|
||||
|
|
Loading…
Reference in New Issue