You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/10/25 15:10:51 UTC
svn commit: r1402140 [10/17] - in /lucene/dev/branches/LUCENE-2878: ./
dev-tools/ dev-tools/eclipse/ dev-tools/eclipse/dot.settings/
dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/classification/
dev-tools/maven/ dev-tools/maven/lucene/classific...
Modified: lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/fst/TestFSTs.java Thu Oct 25 13:10:25 2012
@@ -29,8 +29,6 @@ import java.io.Writer;
import java.util.*;
import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.codecs.Codec;
-import org.apache.lucene.codecs.lucene40.Lucene40PostingsFormat;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.DirectoryReader;
@@ -56,7 +54,6 @@ import org.apache.lucene.util.LineFileDo
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.lucene.util.LuceneTestCase.SuppressCodecs;
import org.apache.lucene.util.LuceneTestCase;
-import org.apache.lucene.util.UnicodeUtil;
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.automaton.Automaton;
import org.apache.lucene.util.automaton.CompiledAutomaton;
@@ -67,6 +64,10 @@ import org.apache.lucene.util.fst.FST.By
import org.apache.lucene.util.fst.PairOutputs.Pair;
import org.apache.lucene.util.packed.PackedInts;
+import static org.apache.lucene.util.fst.FSTTester.getRandomString;
+import static org.apache.lucene.util.fst.FSTTester.simpleRandomString;
+import static org.apache.lucene.util.fst.FSTTester.toIntsRef;
+
@SuppressCodecs({ "SimpleText", "Memory", "Direct" })
@Slow
public class TestFSTs extends LuceneTestCase {
@@ -87,59 +88,6 @@ public class TestFSTs extends LuceneTest
super.tearDown();
}
- private static BytesRef toBytesRef(IntsRef ir) {
- BytesRef br = new BytesRef(ir.length);
- for(int i=0;i<ir.length;i++) {
- int x = ir.ints[ir.offset+i];
- assert x >= 0 && x <= 255;
- br.bytes[i] = (byte) x;
- }
- br.length = ir.length;
- return br;
- }
-
- static IntsRef toIntsRef(String s, int inputMode) {
- return toIntsRef(s, inputMode, new IntsRef(10));
- }
-
- static IntsRef toIntsRef(String s, int inputMode, IntsRef ir) {
- if (inputMode == 0) {
- // utf8
- return toIntsRef(new BytesRef(s), ir);
- } else {
- // utf32
- return toIntsRefUTF32(s, ir);
- }
- }
-
- static IntsRef toIntsRefUTF32(String s, IntsRef ir) {
- final int charLength = s.length();
- int charIdx = 0;
- int intIdx = 0;
- while(charIdx < charLength) {
- if (intIdx == ir.ints.length) {
- ir.grow(intIdx+1);
- }
- final int utf32 = s.codePointAt(charIdx);
- ir.ints[intIdx] = utf32;
- charIdx += Character.charCount(utf32);
- intIdx++;
- }
- ir.length = intIdx;
- return ir;
- }
-
- static IntsRef toIntsRef(BytesRef br, IntsRef ir) {
- if (br.length > ir.ints.length) {
- ir.grow(br.length);
- }
- for(int i=0;i<br.length;i++) {
- ir.ints[i] = br.bytes[br.offset+i]&0xFF;
- }
- ir.length = br.length;
- return ir;
- }
-
public void testBasicFSA() throws IOException {
String[] strings = new String[] {"station", "commotion", "elation", "elastic", "plastic", "stop", "ftop", "ftation", "stat"};
String[] strings2 = new String[] {"station", "commotion", "elation", "elastic", "plastic", "stop", "ftop", "ftation"};
@@ -206,19 +154,6 @@ public class TestFSTs extends LuceneTest
}
}
- private static String simpleRandomString(Random r) {
- final int end = r.nextInt(10);
- if (end == 0) {
- // allow 0 length
- return "";
- }
- final char[] buffer = new char[end];
- for (int i = 0; i < end; i++) {
- buffer[i] = (char) _TestUtil.nextInt(r, 97, 102);
- }
- return new String(buffer, 0, end);
- }
-
// given set of terms, test the different outputs for them
private void doTest(int inputMode, IntsRef[] terms) throws IOException {
Arrays.sort(terms);
@@ -231,7 +166,7 @@ public class TestFSTs extends LuceneTest
for(IntsRef term : terms) {
pairs.add(new FSTTester.InputOutput<Object>(term, NO_OUTPUT));
}
- new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest();
+ new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest(true);
}
// PositiveIntOutput (ord)
@@ -241,7 +176,7 @@ public class TestFSTs extends LuceneTest
for(int idx=0;idx<terms.length;idx++) {
pairs.add(new FSTTester.InputOutput<Long>(terms[idx], (long) idx));
}
- new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, true).doTest();
+ new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, true).doTest(true);
}
// PositiveIntOutput (random monotonically increasing positive number)
@@ -255,7 +190,7 @@ public class TestFSTs extends LuceneTest
lastOutput = value;
pairs.add(new FSTTester.InputOutput<Long>(terms[idx], value));
}
- new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, doShare).doTest();
+ new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, doShare).doTest(true);
}
// PositiveIntOutput (random positive number)
@@ -265,7 +200,7 @@ public class TestFSTs extends LuceneTest
for(int idx=0;idx<terms.length;idx++) {
pairs.add(new FSTTester.InputOutput<Long>(terms[idx], _TestUtil.nextLong(random(), 0, Long.MAX_VALUE)));
}
- new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, false).doTest();
+ new FSTTester<Long>(random(), dir, inputMode, pairs, outputs, false).doTest(true);
}
// Pair<ord, (random monotonically increasing positive number>
@@ -281,7 +216,7 @@ public class TestFSTs extends LuceneTest
pairs.add(new FSTTester.InputOutput<PairOutputs.Pair<Long,Long>>(terms[idx],
outputs.newPair((long) idx, value)));
}
- new FSTTester<PairOutputs.Pair<Long,Long>>(random(), dir, inputMode, pairs, outputs, false).doTest();
+ new FSTTester<PairOutputs.Pair<Long,Long>>(random(), dir, inputMode, pairs, outputs, false).doTest(true);
}
// Sequence-of-bytes
@@ -293,7 +228,7 @@ public class TestFSTs extends LuceneTest
final BytesRef output = random().nextInt(30) == 17 ? NO_OUTPUT : new BytesRef(Integer.toString(idx));
pairs.add(new FSTTester.InputOutput<BytesRef>(terms[idx], output));
}
- new FSTTester<BytesRef>(random(), dir, inputMode, pairs, outputs, false).doTest();
+ new FSTTester<BytesRef>(random(), dir, inputMode, pairs, outputs, false).doTest(true);
}
// Sequence-of-ints
@@ -309,722 +244,11 @@ public class TestFSTs extends LuceneTest
}
pairs.add(new FSTTester.InputOutput<IntsRef>(terms[idx], output));
}
- new FSTTester<IntsRef>(random(), dir, inputMode, pairs, outputs, false).doTest();
+ new FSTTester<IntsRef>(random(), dir, inputMode, pairs, outputs, false).doTest(true);
}
- // Up to two positive ints, shared, generally but not
- // monotonically increasing
- {
- if (VERBOSE) {
- System.out.println("TEST: now test UpToTwoPositiveIntOutputs");
- }
- final UpToTwoPositiveIntOutputs outputs = UpToTwoPositiveIntOutputs.getSingleton(true);
- final List<FSTTester.InputOutput<Object>> pairs = new ArrayList<FSTTester.InputOutput<Object>>(terms.length);
- long lastOutput = 0;
- for(int idx=0;idx<terms.length;idx++) {
- // Sometimes go backwards
- long value = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
- while(value < 0) {
- value = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
- }
- final Object output;
- if (random().nextInt(5) == 3) {
- long value2 = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
- while(value2 < 0) {
- value2 = lastOutput + _TestUtil.nextInt(random(), -100, 1000);
- }
- output = outputs.get(value, value2);
- } else {
- output = outputs.get(value);
- }
- pairs.add(new FSTTester.InputOutput<Object>(terms[idx], output));
- }
- new FSTTester<Object>(random(), dir, inputMode, pairs, outputs, false).doTest();
- }
}
- private static class FSTTester<T> {
-
- final Random random;
- final List<InputOutput<T>> pairs;
- final int inputMode;
- final Outputs<T> outputs;
- final Directory dir;
- final boolean doReverseLookup;
-
- public FSTTester(Random random, Directory dir, int inputMode, List<InputOutput<T>> pairs, Outputs<T> outputs, boolean doReverseLookup) {
- this.random = random;
- this.dir = dir;
- this.inputMode = inputMode;
- this.pairs = pairs;
- this.outputs = outputs;
- this.doReverseLookup = doReverseLookup;
- }
-
- private static class InputOutput<T> implements Comparable<InputOutput<T>> {
- public final IntsRef input;
- public final T output;
-
- public InputOutput(IntsRef input, T output) {
- this.input = input;
- this.output = output;
- }
-
- public int compareTo(InputOutput<T> other) {
- if (other instanceof InputOutput) {
- return input.compareTo((other).input);
- } else {
- throw new IllegalArgumentException();
- }
- }
- }
-
- public void doTest() throws IOException {
- // no pruning
- doTest(0, 0, true);
-
- if (!(outputs instanceof UpToTwoPositiveIntOutputs)) {
- // simple pruning
- doTest(_TestUtil.nextInt(random, 1, 1+pairs.size()), 0, true);
-
- // leafy pruning
- doTest(0, _TestUtil.nextInt(random, 1, 1+pairs.size()), true);
- }
- }
-
- // runs the term, returning the output, or null if term
- // isn't accepted. if prefixLength is non-null it must be
- // length 1 int array; prefixLength[0] is set to the length
- // of the term prefix that matches
- private T run(FST<T> fst, IntsRef term, int[] prefixLength) throws IOException {
- assert prefixLength == null || prefixLength.length == 1;
- final FST.Arc<T> arc = fst.getFirstArc(new FST.Arc<T>());
- final T NO_OUTPUT = fst.outputs.getNoOutput();
- T output = NO_OUTPUT;
- final FST.BytesReader fstReader = fst.getBytesReader(0);
-
- for(int i=0;i<=term.length;i++) {
- final int label;
- if (i == term.length) {
- label = FST.END_LABEL;
- } else {
- label = term.ints[term.offset+i];
- }
- // System.out.println(" loop i=" + i + " label=" + label + " output=" + fst.outputs.outputToString(output) + " curArc: target=" + arc.target + " isFinal?=" + arc.isFinal());
- if (fst.findTargetArc(label, arc, arc, fstReader) == null) {
- // System.out.println(" not found");
- if (prefixLength != null) {
- prefixLength[0] = i;
- return output;
- } else {
- return null;
- }
- }
- output = fst.outputs.add(output, arc.output);
- }
-
- if (prefixLength != null) {
- prefixLength[0] = term.length;
- }
-
- return output;
- }
-
- private T randomAcceptedWord(FST<T> fst, IntsRef in) throws IOException {
- FST.Arc<T> arc = fst.getFirstArc(new FST.Arc<T>());
-
- final List<FST.Arc<T>> arcs = new ArrayList<FST.Arc<T>>();
- in.length = 0;
- in.offset = 0;
- final T NO_OUTPUT = fst.outputs.getNoOutput();
- T output = NO_OUTPUT;
- final FST.BytesReader fstReader = fst.getBytesReader(0);
-
- while(true) {
- // read all arcs:
- fst.readFirstTargetArc(arc, arc, fstReader);
- arcs.add(new FST.Arc<T>().copyFrom(arc));
- while(!arc.isLast()) {
- fst.readNextArc(arc, fstReader);
- arcs.add(new FST.Arc<T>().copyFrom(arc));
- }
-
- // pick one
- arc = arcs.get(random.nextInt(arcs.size()));
- arcs.clear();
-
- // accumulate output
- output = fst.outputs.add(output, arc.output);
-
- // append label
- if (arc.label == FST.END_LABEL) {
- break;
- }
-
- if (in.ints.length == in.length) {
- in.grow(1+in.length);
- }
- in.ints[in.length++] = arc.label;
- }
-
- return output;
- }
-
-
- FST<T> doTest(int prune1, int prune2, boolean allowRandomSuffixSharing) throws IOException {
- if (VERBOSE) {
- System.out.println("\nTEST: prune1=" + prune1 + " prune2=" + prune2);
- }
-
- final boolean willRewrite = random.nextBoolean();
-
- final Builder<T> builder = new Builder<T>(inputMode == 0 ? FST.INPUT_TYPE.BYTE1 : FST.INPUT_TYPE.BYTE4,
- prune1, prune2,
- prune1==0 && prune2==0,
- allowRandomSuffixSharing ? random.nextBoolean() : true,
- allowRandomSuffixSharing ? _TestUtil.nextInt(random, 1, 10) : Integer.MAX_VALUE,
- outputs,
- null,
- willRewrite);
-
- for(InputOutput<T> pair : pairs) {
- if (pair.output instanceof UpToTwoPositiveIntOutputs.TwoLongs) {
- final UpToTwoPositiveIntOutputs _outputs = (UpToTwoPositiveIntOutputs) outputs;
- final UpToTwoPositiveIntOutputs.TwoLongs twoLongs = (UpToTwoPositiveIntOutputs.TwoLongs) pair.output;
- @SuppressWarnings("unchecked") final Builder<Object> builderObject = (Builder<Object>) builder;
- builderObject.add(pair.input, _outputs.get(twoLongs.first));
- builderObject.add(pair.input, _outputs.get(twoLongs.second));
- } else {
- builder.add(pair.input, pair.output);
- }
- }
- FST<T> fst = builder.finish();
-
- if (random.nextBoolean() && fst != null && !willRewrite) {
- IOContext context = LuceneTestCase.newIOContext(random);
- IndexOutput out = dir.createOutput("fst.bin", context);
- fst.save(out);
- out.close();
- IndexInput in = dir.openInput("fst.bin", context);
- try {
- fst = new FST<T>(in, outputs);
- } finally {
- in.close();
- dir.deleteFile("fst.bin");
- }
- }
-
- if (VERBOSE && pairs.size() <= 20 && fst != null) {
- Writer w = new OutputStreamWriter(new FileOutputStream("out.dot"), "UTF-8");
- Util.toDot(fst, w, false, false);
- w.close();
- System.out.println("SAVED out.dot");
- }
-
- if (VERBOSE) {
- if (fst == null) {
- System.out.println(" fst has 0 nodes (fully pruned)");
- } else {
- System.out.println(" fst has " + fst.getNodeCount() + " nodes and " + fst.getArcCount() + " arcs");
- }
- }
-
- if (prune1 == 0 && prune2 == 0) {
- verifyUnPruned(inputMode, fst);
- } else {
- verifyPruned(inputMode, fst, prune1, prune2);
- }
-
- if (willRewrite && fst != null) {
- if (VERBOSE) {
- System.out.println("TEST: now rewrite");
- }
- final FST<T> packed = fst.pack(_TestUtil.nextInt(random, 1, 10), _TestUtil.nextInt(random, 0, 10000000), random.nextFloat());
- if (VERBOSE) {
- System.out.println("TEST: now verify packed FST");
- }
- if (prune1 == 0 && prune2 == 0) {
- verifyUnPruned(inputMode, packed);
- } else {
- verifyPruned(inputMode, packed, prune1, prune2);
- }
- }
-
- return fst;
- }
-
- // FST is complete
- private void verifyUnPruned(int inputMode, FST<T> fst) throws IOException {
-
- final FST<Long> fstLong;
- final Set<Long> validOutputs;
- long minLong = Long.MAX_VALUE;
- long maxLong = Long.MIN_VALUE;
-
- if (doReverseLookup) {
- @SuppressWarnings("unchecked") FST<Long> fstLong0 = (FST<Long>) fst;
- fstLong = fstLong0;
- validOutputs = new HashSet<Long>();
- for(InputOutput<T> pair: pairs) {
- Long output = (Long) pair.output;
- maxLong = Math.max(maxLong, output);
- minLong = Math.min(minLong, output);
- validOutputs.add(output);
- }
- } else {
- fstLong = null;
- validOutputs = null;
- }
-
- if (pairs.size() == 0) {
- assertNull(fst);
- return;
- }
-
- if (VERBOSE) {
- System.out.println("TEST: now verify " + pairs.size() + " terms");
- for(InputOutput<T> pair : pairs) {
- assertNotNull(pair);
- assertNotNull(pair.input);
- assertNotNull(pair.output);
- System.out.println(" " + inputToString(inputMode, pair.input) + ": " + outputs.outputToString(pair.output));
- }
- }
-
- assertNotNull(fst);
-
- // visit valid pairs in order -- make sure all words
- // are accepted, and FSTEnum's next() steps through
- // them correctly
- if (VERBOSE) {
- System.out.println("TEST: check valid terms/next()");
- }
- {
- IntsRefFSTEnum<T> fstEnum = new IntsRefFSTEnum<T>(fst);
- for(InputOutput<T> pair : pairs) {
- IntsRef term = pair.input;
- if (VERBOSE) {
- System.out.println("TEST: check term=" + inputToString(inputMode, term) + " output=" + fst.outputs.outputToString(pair.output));
- }
- Object output = run(fst, term, null);
- assertNotNull("term " + inputToString(inputMode, term) + " is not accepted", output);
- assertEquals(pair.output, output);
-
- // verify enum's next
- IntsRefFSTEnum.InputOutput<T> t = fstEnum.next();
- assertNotNull(t);
- assertEquals("expected input=" + inputToString(inputMode, term) + " but fstEnum returned " + inputToString(inputMode, t.input), term, t.input);
- assertEquals(pair.output, t.output);
- }
- assertNull(fstEnum.next());
- }
-
- final Map<IntsRef,T> termsMap = new HashMap<IntsRef,T>();
- for(InputOutput<T> pair : pairs) {
- termsMap.put(pair.input, pair.output);
- }
-
- if (doReverseLookup && maxLong > minLong) {
- // Do random lookups so we test null (output doesn't
- // exist) case:
- assertNull(Util.getByOutput(fstLong, minLong-7));
- assertNull(Util.getByOutput(fstLong, maxLong+7));
-
- final int num = atLeast(100);
- for(int iter=0;iter<num;iter++) {
- Long v = _TestUtil.nextLong(random, minLong, maxLong);
- IntsRef input = Util.getByOutput(fstLong, v);
- assertTrue(validOutputs.contains(v) || input == null);
- }
- }
-
- // find random matching word and make sure it's valid
- if (VERBOSE) {
- System.out.println("TEST: verify random accepted terms");
- }
- final IntsRef scratch = new IntsRef(10);
- int num = atLeast(500);
- for(int iter=0;iter<num;iter++) {
- T output = randomAcceptedWord(fst, scratch);
- assertTrue("accepted word " + inputToString(inputMode, scratch) + " is not valid", termsMap.containsKey(scratch));
- assertEquals(termsMap.get(scratch), output);
-
- if (doReverseLookup) {
- //System.out.println("lookup output=" + output + " outs=" + fst.outputs);
- IntsRef input = Util.getByOutput(fstLong, (Long) output);
- assertNotNull(input);
- //System.out.println(" got " + Util.toBytesRef(input, new BytesRef()).utf8ToString());
- assertEquals(scratch, input);
- }
- }
-
- // test IntsRefFSTEnum.seek:
- if (VERBOSE) {
- System.out.println("TEST: verify seek");
- }
- IntsRefFSTEnum<T> fstEnum = new IntsRefFSTEnum<T>(fst);
- num = atLeast(100);
- for(int iter=0;iter<num;iter++) {
- if (VERBOSE) {
- System.out.println(" iter=" + iter);
- }
- if (random.nextBoolean()) {
- // seek to term that doesn't exist:
- while(true) {
- final IntsRef term = toIntsRef(getRandomString(random), inputMode);
- int pos = Collections.binarySearch(pairs, new InputOutput<T>(term, null));
- if (pos < 0) {
- pos = -(pos+1);
- // ok doesn't exist
- //System.out.println(" seek " + inputToString(inputMode, term));
- final IntsRefFSTEnum.InputOutput<T> seekResult;
- if (random.nextInt(3) == 0) {
- if (VERBOSE) {
- System.out.println(" do non-exist seekExact term=" + inputToString(inputMode, term));
- }
- seekResult = fstEnum.seekExact(term);
- pos = -1;
- } else if (random.nextBoolean()) {
- if (VERBOSE) {
- System.out.println(" do non-exist seekFloor term=" + inputToString(inputMode, term));
- }
- seekResult = fstEnum.seekFloor(term);
- pos--;
- } else {
- if (VERBOSE) {
- System.out.println(" do non-exist seekCeil term=" + inputToString(inputMode, term));
- }
- seekResult = fstEnum.seekCeil(term);
- }
-
- if (pos != -1 && pos < pairs.size()) {
- //System.out.println(" got " + inputToString(inputMode,seekResult.input) + " output=" + fst.outputs.outputToString(seekResult.output));
- assertNotNull("got null but expected term=" + inputToString(inputMode, pairs.get(pos).input), seekResult);
- if (VERBOSE) {
- System.out.println(" got " + inputToString(inputMode, seekResult.input));
- }
- assertEquals("expected " + inputToString(inputMode, pairs.get(pos).input) + " but got " + inputToString(inputMode, seekResult.input), pairs.get(pos).input, seekResult.input);
- assertEquals(pairs.get(pos).output, seekResult.output);
- } else {
- // seeked before start or beyond end
- //System.out.println("seek=" + seekTerm);
- assertNull("expected null but got " + (seekResult==null ? "null" : inputToString(inputMode, seekResult.input)), seekResult);
- if (VERBOSE) {
- System.out.println(" got null");
- }
- }
-
- break;
- }
- }
- } else {
- // seek to term that does exist:
- InputOutput<T> pair = pairs.get(random.nextInt(pairs.size()));
- final IntsRefFSTEnum.InputOutput<T> seekResult;
- if (random.nextInt(3) == 2) {
- if (VERBOSE) {
- System.out.println(" do exists seekExact term=" + inputToString(inputMode, pair.input));
- }
- seekResult = fstEnum.seekExact(pair.input);
- } else if (random.nextBoolean()) {
- if (VERBOSE) {
- System.out.println(" do exists seekFloor " + inputToString(inputMode, pair.input));
- }
- seekResult = fstEnum.seekFloor(pair.input);
- } else {
- if (VERBOSE) {
- System.out.println(" do exists seekCeil " + inputToString(inputMode, pair.input));
- }
- seekResult = fstEnum.seekCeil(pair.input);
- }
- assertNotNull(seekResult);
- assertEquals("got " + inputToString(inputMode, seekResult.input) + " but expected " + inputToString(inputMode, pair.input), pair.input, seekResult.input);
- assertEquals(pair.output, seekResult.output);
- }
- }
-
- if (VERBOSE) {
- System.out.println("TEST: mixed next/seek");
- }
-
- // test mixed next/seek
- num = atLeast(100);
- for(int iter=0;iter<num;iter++) {
- if (VERBOSE) {
- System.out.println("TEST: iter " + iter);
- }
- // reset:
- fstEnum = new IntsRefFSTEnum<T>(fst);
- int upto = -1;
- while(true) {
- boolean isDone = false;
- if (upto == pairs.size()-1 || random.nextBoolean()) {
- // next
- upto++;
- if (VERBOSE) {
- System.out.println(" do next");
- }
- isDone = fstEnum.next() == null;
- } else if (upto != -1 && upto < 0.75 * pairs.size() && random.nextBoolean()) {
- int attempt = 0;
- for(;attempt<10;attempt++) {
- IntsRef term = toIntsRef(getRandomString(random), inputMode);
- if (!termsMap.containsKey(term) && term.compareTo(pairs.get(upto).input) > 0) {
- int pos = Collections.binarySearch(pairs, new InputOutput<T>(term, null));
- assert pos < 0;
- upto = -(pos+1);
-
- if (random.nextBoolean()) {
- upto--;
- assertTrue(upto != -1);
- if (VERBOSE) {
- System.out.println(" do non-exist seekFloor(" + inputToString(inputMode, term) + ")");
- }
- isDone = fstEnum.seekFloor(term) == null;
- } else {
- if (VERBOSE) {
- System.out.println(" do non-exist seekCeil(" + inputToString(inputMode, term) + ")");
- }
- isDone = fstEnum.seekCeil(term) == null;
- }
-
- break;
- }
- }
- if (attempt == 10) {
- continue;
- }
-
- } else {
- final int inc = random.nextInt(pairs.size() - upto - 1);
- upto += inc;
- if (upto == -1) {
- upto = 0;
- }
-
- if (random.nextBoolean()) {
- if (VERBOSE) {
- System.out.println(" do seekCeil(" + inputToString(inputMode, pairs.get(upto).input) + ")");
- }
- isDone = fstEnum.seekCeil(pairs.get(upto).input) == null;
- } else {
- if (VERBOSE) {
- System.out.println(" do seekFloor(" + inputToString(inputMode, pairs.get(upto).input) + ")");
- }
- isDone = fstEnum.seekFloor(pairs.get(upto).input) == null;
- }
- }
- if (VERBOSE) {
- if (!isDone) {
- System.out.println(" got " + inputToString(inputMode, fstEnum.current().input));
- } else {
- System.out.println(" got null");
- }
- }
-
- if (upto == pairs.size()) {
- assertTrue(isDone);
- break;
- } else {
- assertFalse(isDone);
- assertEquals(pairs.get(upto).input, fstEnum.current().input);
- assertEquals(pairs.get(upto).output, fstEnum.current().output);
-
- /*
- if (upto < pairs.size()-1) {
- int tryCount = 0;
- while(tryCount < 10) {
- final IntsRef t = toIntsRef(getRandomString(), inputMode);
- if (pairs.get(upto).input.compareTo(t) < 0) {
- final boolean expected = t.compareTo(pairs.get(upto+1).input) < 0;
- if (VERBOSE) {
- System.out.println("TEST: call beforeNext(" + inputToString(inputMode, t) + "); current=" + inputToString(inputMode, pairs.get(upto).input) + " next=" + inputToString(inputMode, pairs.get(upto+1).input) + " expected=" + expected);
- }
- assertEquals(expected, fstEnum.beforeNext(t));
- break;
- }
- tryCount++;
- }
- }
- */
- }
- }
- }
- }
-
- private static class CountMinOutput<T> {
- int count;
- T output;
- T finalOutput;
- boolean isLeaf = true;
- boolean isFinal;
- }
-
- // FST is pruned
- private void verifyPruned(int inputMode, FST<T> fst, int prune1, int prune2) throws IOException {
-
- if (VERBOSE) {
- System.out.println("TEST: now verify pruned " + pairs.size() + " terms; outputs=" + outputs);
- for(InputOutput<T> pair : pairs) {
- System.out.println(" " + inputToString(inputMode, pair.input) + ": " + outputs.outputToString(pair.output));
- }
- }
-
- // To validate the FST, we brute-force compute all prefixes
- // in the terms, matched to their "common" outputs, prune that
- // set according to the prune thresholds, then assert the FST
- // matches that same set.
-
- // NOTE: Crazy RAM intensive!!
-
- //System.out.println("TEST: tally prefixes");
-
- // build all prefixes
- final Map<IntsRef,CountMinOutput<T>> prefixes = new HashMap<IntsRef,CountMinOutput<T>>();
- final IntsRef scratch = new IntsRef(10);
- for(InputOutput<T> pair: pairs) {
- scratch.copyInts(pair.input);
- for(int idx=0;idx<=pair.input.length;idx++) {
- scratch.length = idx;
- CountMinOutput<T> cmo = prefixes.get(scratch);
- if (cmo == null) {
- cmo = new CountMinOutput<T>();
- cmo.count = 1;
- cmo.output = pair.output;
- prefixes.put(IntsRef.deepCopyOf(scratch), cmo);
- } else {
- cmo.count++;
- T output1 = cmo.output;
- if (output1.equals(outputs.getNoOutput())) {
- output1 = outputs.getNoOutput();
- }
- T output2 = pair.output;
- if (output2.equals(outputs.getNoOutput())) {
- output2 = outputs.getNoOutput();
- }
- cmo.output = outputs.common(output1, output2);
- }
- if (idx == pair.input.length) {
- cmo.isFinal = true;
- cmo.finalOutput = cmo.output;
- }
- }
- }
-
- if (VERBOSE) {
- System.out.println("TEST: now prune");
- }
-
- // prune 'em
- final Iterator<Map.Entry<IntsRef,CountMinOutput<T>>> it = prefixes.entrySet().iterator();
- while(it.hasNext()) {
- Map.Entry<IntsRef,CountMinOutput<T>> ent = it.next();
- final IntsRef prefix = ent.getKey();
- final CountMinOutput<T> cmo = ent.getValue();
- if (VERBOSE) {
- System.out.println(" term prefix=" + inputToString(inputMode, prefix, false) + " count=" + cmo.count + " isLeaf=" + cmo.isLeaf + " output=" + outputs.outputToString(cmo.output) + " isFinal=" + cmo.isFinal);
- }
- final boolean keep;
- if (prune1 > 0) {
- keep = cmo.count >= prune1;
- } else {
- assert prune2 > 0;
- if (prune2 > 1 && cmo.count >= prune2) {
- keep = true;
- } else if (prefix.length > 0) {
- // consult our parent
- scratch.length = prefix.length-1;
- System.arraycopy(prefix.ints, prefix.offset, scratch.ints, 0, scratch.length);
- final CountMinOutput<T> cmo2 = prefixes.get(scratch);
- //System.out.println(" parent count = " + (cmo2 == null ? -1 : cmo2.count));
- keep = cmo2 != null && ((prune2 > 1 && cmo2.count >= prune2) || (prune2 == 1 && (cmo2.count >= 2 || prefix.length <= 1)));
- } else if (cmo.count >= prune2) {
- keep = true;
- } else {
- keep = false;
- }
- }
-
- if (!keep) {
- it.remove();
- //System.out.println(" remove");
- } else {
- // clear isLeaf for all ancestors
- //System.out.println(" keep");
- scratch.copyInts(prefix);
- scratch.length--;
- while(scratch.length >= 0) {
- final CountMinOutput<T> cmo2 = prefixes.get(scratch);
- if (cmo2 != null) {
- //System.out.println(" clear isLeaf " + inputToString(inputMode, scratch));
- cmo2.isLeaf = false;
- }
- scratch.length--;
- }
- }
- }
-
- if (VERBOSE) {
- System.out.println("TEST: after prune");
- for(Map.Entry<IntsRef,CountMinOutput<T>> ent : prefixes.entrySet()) {
- System.out.println(" " + inputToString(inputMode, ent.getKey(), false) + ": isLeaf=" + ent.getValue().isLeaf + " isFinal=" + ent.getValue().isFinal);
- if (ent.getValue().isFinal) {
- System.out.println(" finalOutput=" + outputs.outputToString(ent.getValue().finalOutput));
- }
- }
- }
-
- if (prefixes.size() <= 1) {
- assertNull(fst);
- return;
- }
-
- assertNotNull(fst);
-
- // make sure FST only enums valid prefixes
- if (VERBOSE) {
- System.out.println("TEST: check pruned enum");
- }
- IntsRefFSTEnum<T> fstEnum = new IntsRefFSTEnum<T>(fst);
- IntsRefFSTEnum.InputOutput<T> current;
- while((current = fstEnum.next()) != null) {
- if (VERBOSE) {
- System.out.println(" fstEnum.next prefix=" + inputToString(inputMode, current.input, false) + " output=" + outputs.outputToString(current.output));
- }
- final CountMinOutput<T> cmo = prefixes.get(current.input);
- assertNotNull(cmo);
- assertTrue(cmo.isLeaf || cmo.isFinal);
- //if (cmo.isFinal && !cmo.isLeaf) {
- if (cmo.isFinal) {
- assertEquals(cmo.finalOutput, current.output);
- } else {
- assertEquals(cmo.output, current.output);
- }
- }
-
- // make sure all non-pruned prefixes are present in the FST
- if (VERBOSE) {
- System.out.println("TEST: verify all prefixes");
- }
- final int[] stopNode = new int[1];
- for(Map.Entry<IntsRef,CountMinOutput<T>> ent : prefixes.entrySet()) {
- if (ent.getKey().length > 0) {
- final CountMinOutput<T> cmo = ent.getValue();
- final T output = run(fst, ent.getKey(), stopNode);
- if (VERBOSE) {
- System.out.println("TEST: verify prefix=" + inputToString(inputMode, ent.getKey(), false) + " output=" + outputs.outputToString(cmo.output));
- }
- // if (cmo.isFinal && !cmo.isLeaf) {
- if (cmo.isFinal) {
- assertEquals(cmo.finalOutput, output);
- } else {
- assertEquals(cmo.output, output);
- }
- assertEquals(ent.getKey().length, stopNode[0]);
- }
- }
- }
- }
public void testRandomWords() throws IOException {
testRandomWords(1000, atLeast(2));
@@ -1058,40 +282,11 @@ public class TestFSTs extends LuceneTest
}
}
- static String getRandomString(Random random) {
- final String term;
- if (random.nextBoolean()) {
- term = _TestUtil.randomRealisticUnicodeString(random);
- } else {
- // we want to mix in limited-alphabet symbols so
- // we get more sharing of the nodes given how few
- // terms we are testing...
- term = simpleRandomString(random);
- }
- return term;
- }
-
@Nightly
public void testBigSet() throws IOException {
testRandomWords(_TestUtil.nextInt(random(), 50000, 60000), 1);
}
- static String inputToString(int inputMode, IntsRef term) {
- return inputToString(inputMode, term, true);
- }
-
- private static String inputToString(int inputMode, IntsRef term, boolean isValidUnicode) {
- if (!isValidUnicode) {
- return term.toString();
- } else if (inputMode == 0) {
- // utf8
- return toBytesRef(term).utf8ToString() + " " + term;
- } else {
- // utf32
- return UnicodeUtil.newString(term.ints, term.offset, term.length) + " " + term;
- }
- }
-
// Build FST for all unique terms in the test line docs
// file, up until a time limit
public void testRealTerms() throws Exception {
@@ -2011,9 +1206,11 @@ public class TestFSTs extends LuceneTest
//w.close();
Util.MinResult<Long>[] r = Util.shortestPaths(fst,
- fst.getFirstArc(new FST.Arc<Long>()),
- minLongComparator,
- 3);
+ fst.getFirstArc(new FST.Arc<Long>()),
+ outputs.getNoOutput(),
+ minLongComparator,
+ 3,
+ true);
assertEquals(3, r.length);
assertEquals(Util.toIntsRef(new BytesRef("aac"), scratch), r[0].input);
@@ -2053,9 +1250,11 @@ public class TestFSTs extends LuceneTest
//w.close();
Util.MinResult<Pair<Long,Long>>[] r = Util.shortestPaths(fst,
- fst.getFirstArc(new FST.Arc<Pair<Long,Long>>()),
- minPairWeightComparator,
- 3);
+ fst.getFirstArc(new FST.Arc<Pair<Long,Long>>()),
+ outputs.getNoOutput(),
+ minPairWeightComparator,
+ 3,
+ true);
assertEquals(3, r.length);
assertEquals(Util.toIntsRef(new BytesRef("aac"), scratch), r[0].input);
@@ -2127,7 +1326,7 @@ public class TestFSTs extends LuceneTest
final int topN = _TestUtil.nextInt(random, 1, 10);
- Util.MinResult<Long>[] r = Util.shortestPaths(fst, arc, minLongComparator, topN);
+ Util.MinResult<Long>[] r = Util.shortestPaths(fst, arc, fst.outputs.getNoOutput(), minLongComparator, topN, true);
// 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
final List<Util.MinResult<Long>> matches = new ArrayList<Util.MinResult<Long>>();
@@ -2231,7 +1430,7 @@ public class TestFSTs extends LuceneTest
final int topN = _TestUtil.nextInt(random, 1, 10);
- Util.MinResult<Pair<Long,Long>>[] r = Util.shortestPaths(fst, arc, minPairWeightComparator, topN);
+ Util.MinResult<Pair<Long,Long>>[] r = Util.shortestPaths(fst, arc, fst.outputs.getNoOutput(), minPairWeightComparator, topN, true);
// 2. go thru whole treemap (slowCompletor) and check its actually the best suggestion
final List<Util.MinResult<Pair<Long,Long>>> matches = new ArrayList<Util.MinResult<Pair<Long,Long>>>();
Modified: lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/core/src/test/org/apache/lucene/util/packed/TestPackedInts.java Thu Oct 25 13:10:25 2012
@@ -38,6 +38,8 @@ import org.apache.lucene.util.LuceneTest
import org.apache.lucene.util._TestUtil;
import org.apache.lucene.util.packed.PackedInts.Reader;
+import org.junit.Ignore;
+
@Slow
public class TestPackedInts extends LuceneTestCase {
public void testBitsRequired() {
@@ -389,6 +391,7 @@ public class TestPackedInts extends Luce
NOTE: this test allocates 256 MB
*/
+ @Ignore("See LUCENE-4488")
public void testIntOverflow() {
int INDEX = (int)Math.pow(2, 30)+1;
int BITS = 2;
Modified: lucene/dev/branches/LUCENE-2878/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/demo/src/java/org/apache/lucene/demo/IndexFiles.java Thu Oct 25 13:10:25 2012
@@ -140,7 +140,7 @@ public class IndexFiles {
*
* @param writer Writer to the index where the given file/dir info will be stored
* @param file The file to index, or the directory to recurse into to find files to index
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error
*/
static void indexDocs(IndexWriter writer, File file)
throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/doc-files/userguide.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/doc-files/userguide.html?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/doc-files/userguide.html (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/doc-files/userguide.html Thu Oct 25 13:10:25 2012
@@ -134,6 +134,7 @@ table.code_description td {
<li class="toc_first"><a href="#optimizations">Optimizations</a></li>
<li class="toc_first"><a href="#concurrent_indexing_search">Concurrent Indexing and Search</a></li>
</ol>
+</div>
<h1 class="section"><a name="intro">Introduction</a></h1>
<p>
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsDocumentBuilder.java Thu Oct 25 13:10:25 2012
@@ -43,7 +43,6 @@ import org.apache.lucene.facet.taxonomy.
public class EnhancementsDocumentBuilder extends CategoryDocumentBuilder {
/**
- * @param taxonomyWriter
* @param params
* Indexing params which include {@link CategoryEnhancement}s.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsPayloadIterator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsPayloadIterator.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsPayloadIterator.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/enhancements/EnhancementsPayloadIterator.java Thu Oct 25 13:10:25 2012
@@ -50,7 +50,7 @@ public class EnhancementsPayloadIterator
* A reader of the index.
* @param term
* The category term to iterate.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public EnhancementsPayloadIterator(
List<CategoryEnhancement> enhancementsList,
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryContainer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryContainer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryContainer.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryContainer.java Thu Oct 25 13:10:25 2012
@@ -204,7 +204,7 @@ public class CategoryContainer implement
* {@link ObjectOutputStream}.<br>
* NOTE: {@link CategoryProperty}s are {@link Serializable}, but do not
* assume that Lucene's {@link Attribute}s are as well
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
protected void serializeCategoryAttribute(ObjectOutputStream out,
CategoryAttribute ca) throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/CategoryDocumentBuilder.java Thu Oct 25 13:10:25 2012
@@ -128,7 +128,7 @@ public class CategoryDocumentBuilder {
* @return This CategoryDocumentBuilder, to enable this one line call:
* {@code new} {@link #CategoryDocumentBuilder(TaxonomyWriter)}.
* {@link #setCategoryPaths(Iterable)}.{@link #build(Document)}.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public CategoryDocumentBuilder setCategoryPaths(
Iterable<CategoryPath> categoryPaths) throws IOException {
@@ -150,7 +150,7 @@ public class CategoryDocumentBuilder {
* @return This CategoryDocumentBuilder, to enable this one line call:
* {@code new} {@link #CategoryDocumentBuilder(TaxonomyWriter)}.
* {@link #setCategories(Iterable)}.{@link #build(Document)}.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public CategoryDocumentBuilder setCategories(
Iterable<CategoryAttribute> categories) throws IOException {
@@ -277,7 +277,7 @@ public class CategoryDocumentBuilder {
* relevant data.
* @return The {@link CategoryTokenizer} to be used in creating category
* tokens.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
protected CategoryTokenizer getCategoryTokenizer(TokenStream categoryStream)
throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/OrdinalMappingAtomicReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/OrdinalMappingAtomicReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/OrdinalMappingAtomicReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/OrdinalMappingAtomicReader.java Thu Oct 25 13:10:25 2012
@@ -59,7 +59,7 @@ import org.apache.lucene.util.encoding.I
* DirectoryReader reader = DirectoryReader.open(oldDir);
* IndexWriterConfig conf = new IndexWriterConfig(VER, ANALYZER);
* IndexWriter writer = new IndexWriter(newDir, conf);
- * List<AtomicReaderContext> leaves = reader.leaves();
+ * List<AtomicReaderContext> leaves = reader.leaves();
* AtomicReader wrappedLeaves[] = new AtomicReader[leaves.size()];
* for (int i = 0; i < leaves.size(); i++) {
* wrappedLeaves[i] = new OrdinalMappingAtomicReader(leaves.get(i).reader(), ordmap);
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/params/PerDimensionIndexingParams.java Thu Oct 25 13:10:25 2012
@@ -95,9 +95,6 @@ public class PerDimensionIndexingParams
/**
* Add a CategoryListParams for a given CategoryPath's dimension or
* "zero-th" category.
- *
- * @param category
- * @param clParams
*/
public void addCategoryListParams(CategoryPath category, CategoryListParams clParams) {
clParamsMap.put(category.getComponent(0), clParams);
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/index/streaming/CategoryAttributesStream.java Thu Oct 25 13:10:25 2012
@@ -32,7 +32,7 @@ import org.apache.lucene.facet.index.att
* <P>
* A CategoryAttributesStream object can be reused for producing more than one
* stream. To do that, the user should cause the underlying
- * Iterable<CategoryAttribute> object to return a new set of categories, and
+ * Iterable<CategoryAttribute> object to return a new set of categories, and
* then call {@link #reset()} to allow this stream to be used again.
*
* @lucene.experimental
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/FacetsAccumulator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/FacetsAccumulator.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/FacetsAccumulator.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/FacetsAccumulator.java Thu Oct 25 13:10:25 2012
@@ -81,7 +81,7 @@ public abstract class FacetsAccumulator
public abstract List<FacetResult> accumulate(ScoredDocIDs docids) throws IOException;
/**
- * @return the complement threshold
+ * Returns the complement threshold.
* @see #setComplementThreshold(double)
*/
public double getComplementThreshold() {
@@ -107,6 +107,7 @@ public abstract class FacetsAccumulator
* <p>
* To disable complements pass {@link #DISABLE_COMPLEMENT}.
* @param complementThreshold the complement threshold to set
+ * @see #getComplementThreshold()
*/
public void setComplementThreshold(double complementThreshold) {
this.complementThreshold = complementThreshold;
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/SamplingWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/SamplingWrapper.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/SamplingWrapper.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/SamplingWrapper.java Thu Oct 25 13:10:25 2012
@@ -88,18 +88,11 @@ public class SamplingWrapper extends Fac
return fixedRes;
}
- /**
- * @see FacetsAccumulator#getComplementThreshold()
- */
@Override
public double getComplementThreshold() {
return delegee.getComplementThreshold();
}
- /**
- * @param complementThreshold
- * @see FacetsAccumulator#setComplementThreshold(double)
- */
@Override
public void setComplementThreshold(double complementThreshold) {
delegee.setComplementThreshold(complementThreshold);
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/StandardFacetsAccumulator.java Thu Oct 25 13:10:25 2012
@@ -230,10 +230,7 @@ public class StandardFacetsAccumulator e
/**
* Iterate over the documents for this partition and fill the facet arrays with the correct
* count/complement count/value.
- * @param docids
- * @param facetArrays
- * @param partition
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
private final void fillArraysForPartition(ScoredDocIDs docids,
FacetArrays facetArrays, int partition) throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/params/FacetRequest.java Thu Oct 25 13:10:25 2012
@@ -318,7 +318,7 @@ public abstract class FacetRequest imple
* index reader in effect.
* @param taxonomy
* reader of taxonomy in effect.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public abstract Aggregator createAggregator(boolean useComplements,
FacetArrays arrays, IndexReader indexReader,
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/SampleFixer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/SampleFixer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/SampleFixer.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/SampleFixer.java Thu Oct 25 13:10:25 2012
@@ -38,7 +38,7 @@ public interface SampleFixer {
* full set of matching documents.
* @param fres
* sample result to be fixed.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public void fixResult(ScoredDocIDs origDocIds, FacetResult fres) throws IOException;
}
\ No newline at end of file
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/Sampler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/Sampler.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/Sampler.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/Sampler.java Thu Oct 25 13:10:25 2012
@@ -4,6 +4,7 @@ import java.io.IOException;
import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.facet.search.CategoryListIterator;
import org.apache.lucene.facet.search.FacetArrays;
import org.apache.lucene.facet.search.ScoredDocIDs;
import org.apache.lucene.facet.search.aggregator.Aggregator;
@@ -203,8 +204,21 @@ public abstract class Sampler {
public OverSampledFacetRequest(FacetRequest orig, int num) {
super(orig.getCategoryPath(), num);
this.orig = orig;
+ setDepth(orig.getDepth());
+ setNumLabel(orig.getNumLabel());
+ setResultMode(orig.getResultMode());
+ setSortBy(orig.getSortBy());
+ setSortOrder(orig.getSortOrder());
+ }
+
+ @Override
+ public CategoryListIterator createCategoryListIterator(IndexReader reader,
+ TaxonomyReader taxo, FacetSearchParams sParams, int partition)
+ throws IOException {
+ return orig.createCategoryListIterator(reader, taxo, sParams, partition);
}
+
@Override
public Aggregator createAggregator(boolean useComplements,
FacetArrays arrays, IndexReader indexReader,
@@ -222,5 +236,10 @@ public abstract class Sampler {
public boolean requireDocumentScore() {
return orig.requireDocumentScore();
}
+
+ @Override
+ public boolean supportsComplements() {
+ return orig.supportsComplements();
+ }
}
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/TakmiSampleFixer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/TakmiSampleFixer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/TakmiSampleFixer.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/search/sampling/TakmiSampleFixer.java Thu Oct 25 13:10:25 2012
@@ -71,7 +71,7 @@ class TakmiSampleFixer implements Sample
* result node to be fixed
* @param docIds
* docids in effect
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
private void fixResultNode(FacetResultNode facetResNode, ScoredDocIDs docIds)
throws IOException {
@@ -88,7 +88,7 @@ class TakmiSampleFixer implements Sample
* result node to be recounted
* @param docIds
* full set of matching documents.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
private void recount(FacetResultNode fresNode, ScoredDocIDs docIds)
throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java Thu Oct 25 13:10:25 2012
@@ -257,7 +257,7 @@ public interface TaxonomyReader extends
* Expert: decreases the refCount of this TaxonomyReader instance.
* If the refCount drops to 0, then pending changes (if any) can be
* committed to the taxonomy index and this reader can be closed.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error.
*/
public void decRef() throws IOException;
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/FloatToObjectMap.java Thu Oct 25 13:10:25 2012
@@ -275,7 +275,6 @@ public class FloatToObjectMap<T> impleme
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>.
- * @param key
*/
protected int calcBaseHashIndex(float key) {
return Float.floatToIntBits(key) & hashFactor;
@@ -339,7 +338,6 @@ public class FloatToObjectMap<T> impleme
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(float key) {
@@ -370,8 +368,6 @@ public class FloatToObjectMap<T> impleme
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntHashSet.java Thu Oct 25 13:10:25 2012
@@ -236,8 +236,6 @@ public class IntHashSet {
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>
* .
- *
- * @param key
*/
protected int calcBaseHashIndex(int key) {
return key & hashFactor;
@@ -282,7 +280,6 @@ public class IntHashSet {
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(int key) {
@@ -313,8 +310,6 @@ public class IntHashSet {
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToDoubleMap.java Thu Oct 25 13:10:25 2012
@@ -276,8 +276,6 @@ public class IntToDoubleMap {
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>
* .
- *
- * @param key
*/
protected int calcBaseHashIndex(int key) {
return key & hashFactor;
@@ -340,7 +338,6 @@ public class IntToDoubleMap {
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(int key) {
@@ -371,8 +368,6 @@ public class IntToDoubleMap {
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToIntMap.java Thu Oct 25 13:10:25 2012
@@ -273,8 +273,6 @@ public class IntToIntMap {
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>.
- *
- * @param key
*/
protected int calcBaseHashIndex(int key) {
return key & hashFactor;
@@ -337,7 +335,6 @@ public class IntToIntMap {
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(int key) {
@@ -368,8 +365,6 @@ public class IntToIntMap {
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/IntToObjectMap.java Thu Oct 25 13:10:25 2012
@@ -275,7 +275,6 @@ public class IntToObjectMap<T> implement
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>.
*
- * @param key
*/
protected int calcBaseHashIndex(int key) {
return key & hashFactor;
@@ -339,7 +338,6 @@ public class IntToObjectMap<T> implement
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(int key) {
@@ -370,8 +368,6 @@ public class IntToObjectMap<T> implement
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToFloatMap.java Thu Oct 25 13:10:25 2012
@@ -275,8 +275,6 @@ public class ObjectToFloatMap<K> {
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>.
- *
- * @param key
*/
protected int calcBaseHashIndex(K key) {
return key.hashCode() & hashFactor;
@@ -341,7 +339,6 @@ public class ObjectToFloatMap<K> {
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(K key) {
@@ -372,8 +369,6 @@ public class ObjectToFloatMap<K> {
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/collections/ObjectToIntMap.java Thu Oct 25 13:10:25 2012
@@ -275,8 +275,6 @@ public class ObjectToIntMap<K> {
/**
* Calculating the baseHash index using the internal <code>hashFactor</code>.
- *
- * @param key
*/
protected int calcBaseHashIndex(K key) {
return key.hashCode() & hashFactor;
@@ -341,7 +339,6 @@ public class ObjectToIntMap<K> {
/**
* Find the actual index of a given key.
*
- * @param key
* @return index of the key. zero if the key wasn't found.
*/
protected int find(K key) {
@@ -372,8 +369,6 @@ public class ObjectToIntMap<K> {
* Some methods use the baseHashIndex. If those call {@link #find} there's
* no need to re-calculate that hash.
*
- * @param key
- * @param baseHashIndex
* @return the index of the given key, or 0 as 'Ground' if the key wasn't
* found.
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/encoding/ChunksIntEncoder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/encoding/ChunksIntEncoder.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/encoding/ChunksIntEncoder.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/java/org/apache/lucene/util/encoding/ChunksIntEncoder.java Thu Oct 25 13:10:25 2012
@@ -47,7 +47,7 @@ import java.io.OutputStream;
* manner: <code><pre class="prettyprint">
* IntEncoder fourFlags =
* new SortingEncoderFilter(new UniqueValuesIntEncoder(new DGapIntEncoder(new FlagsIntEncoderImpl())));
- * </code></pre>
+ * </pre></code>
*
* @lucene.experimental
*/
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/CategoryContainerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/CategoryContainerTest.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/CategoryContainerTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/CategoryContainerTest.java Thu Oct 25 13:10:25 2012
@@ -133,8 +133,6 @@ public class CategoryContainerTest exten
/**
* Test addition of {@link CategoryAttribute} object without properties to a
* {@link CategoryContainer}.
- *
- * @throws FacetException
*/
@Test
public void testAddCategoryAttributeWithoutProperties()
@@ -147,8 +145,6 @@ public class CategoryContainerTest exten
/**
* Test addition of {@link CategoryAttribute} object with property to a
* {@link CategoryContainer}.
- *
- * @throws FacetException
*/
@Test
public void testAddCategoryAttributeWithProperty() throws FacetException {
@@ -174,8 +170,6 @@ public class CategoryContainerTest exten
/**
* Verifies that a {@link CategoryAttributesStream} can be constructed from
* {@link CategoryContainer} and produce the correct number of tokens.
- *
- * @throws IOException
*/
@Test
public void testCategoryAttributesStream() throws IOException {
@@ -190,8 +184,6 @@ public class CategoryContainerTest exten
/**
* Test that {@link CategoryContainer} merges properties.
- *
- * @throws FacetException
*/
@Test
public void testCategoryAttributeMerge() throws FacetException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryAttributesStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryAttributesStreamTest.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryAttributesStreamTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryAttributesStreamTest.java Thu Oct 25 13:10:25 2012
@@ -35,8 +35,6 @@ public class CategoryAttributesStreamTes
/**
* Verifies that a {@link CategoryAttributesStream} accepts
* {@link CategoryAttribute} and passes them on as tokens.
- *
- * @throws IOException
*/
@Test
public void testStream() throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryParentsStreamTest.java Thu Oct 25 13:10:25 2012
@@ -41,8 +41,6 @@ public class CategoryParentsStreamTest e
* Verifies that a {@link CategoryParentsStream} can be constructed from
* {@link CategoryAttributesStream} and produces the correct number of
* tokens with default facet indexing params.
- *
- * @throws IOException
*/
@Test
public void testStreamDefaultParams() throws IOException {
@@ -68,8 +66,6 @@ public class CategoryParentsStreamTest e
* Verifies that a {@link CategoryParentsStream} can be constructed from
* {@link CategoryAttributesStream} and produces the correct number of
* tokens with non top level facet indexing params.
- *
- * @throws IOException
*/
@Test
public void testStreamNonTopLevelParams() throws IOException {
@@ -108,9 +104,6 @@ public class CategoryParentsStreamTest e
/**
* Verifies the correctness when no attributes in parents are retained in
* {@link CategoryParentsStream}.
- *
- * @throws IOException
- * @throws FacetException
*/
@Test
public void testNoRetainableAttributes() throws IOException {
@@ -142,9 +135,6 @@ public class CategoryParentsStreamTest e
/**
* Verifies the correctness when attributes in parents are retained in
* {@link CategoryParentsStream}.
- *
- * @throws IOException
- * @throws FacetException
*/
@Test
public void testRetainableAttributes() throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/index/streaming/CategoryTokenizerTest.java Thu Oct 25 13:10:25 2012
@@ -41,8 +41,6 @@ public class CategoryTokenizerTest exten
/**
* Verifies that a {@link CategoryTokenizer} adds the correct
* {@link CharTermAttribute}s to a {@link CategoryAttributesStream}.
- *
- * @throws IOException
*/
@Test
public void testTokensDefaultParams() throws IOException {
@@ -80,8 +78,6 @@ public class CategoryTokenizerTest exten
/**
* Verifies that {@link CategoryTokenizer} elongates the buffer in
* {@link CharTermAttribute} for long categories.
- *
- * @throws IOException
*/
@Test
public void testLongCategoryPath() throws IOException {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/TestTaxonomyCombined.java Thu Oct 25 13:10:25 2012
@@ -215,8 +215,6 @@ public class TestTaxonomyCombined extend
* testWriterTwice3 is yet another test which tests creating a taxonomy
* in two separate writing sessions. This test used to fail because of
* a bug involving commit(), explained below, and now should succeed.
- *
- * @throws Exception
*/
@Test
public void testWriterTwice3() throws Exception {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/facet/taxonomy/directory/TestDirectoryTaxonomyReader.java Thu Oct 25 13:10:25 2012
@@ -69,7 +69,6 @@ public class TestDirectoryTaxonomyReader
/**
* Test the boolean returned by TR.refresh
- * @throws Exception
*/
@Test
public void testReaderRefreshResult() throws Exception {
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/SlowRAMDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/SlowRAMDirectory.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/SlowRAMDirectory.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/SlowRAMDirectory.java Thu Oct 25 13:10:25 2012
@@ -154,7 +154,6 @@ public class SlowRAMDirectory extends RA
@Override public void flush() throws IOException { io.flush(); }
@Override public long getFilePointer() { return io.getFilePointer(); }
@Override public long length() throws IOException { return io.length(); }
- @Override public void seek(long pos) throws IOException { io.seek(pos); }
}
}
Modified: lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/facet/src/test/org/apache/lucene/util/encoding/EncodingSpeed.java Thu Oct 25 13:10:25 2012
@@ -46,10 +46,6 @@ public class EncodingSpeed {
private static NumberFormat nf;
- /**
- * @param args
- * @throws IOException
- */
public static void main(String[] args) throws IOException {
testFacetIDs(data3630, 3630);
testFacetIDs(data9910, 9910);
Modified: lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Highlighter.java Thu Oct 25 13:10:25 2012
@@ -174,11 +174,7 @@ public class Highlighter
* Low level api to get the most relevant (formatted) sections of the document.
* This method has been made public to allow visibility of score information held in TextFragment objects.
* Thanks to Jason Calabrese for help in redefining the interface.
- * @param tokenStream
- * @param text
- * @param maxNumFragments
- * @param mergeContiguousFragments
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error
* @throws InvalidTokenOffsetsException thrown if any token's endOffset exceeds the provided text's length
*/
public final TextFragment[] getBestTextFragments(
@@ -492,9 +488,6 @@ public class Highlighter
return textFragmenter;
}
- /**
- * @param fragmenter
- */
public void setTextFragmenter(Fragmenter fragmenter)
{
textFragmenter = fragmenter;
@@ -509,9 +502,6 @@ public class Highlighter
}
- /**
- * @param scorer
- */
public void setFragmentScorer(Scorer scorer)
{
fragmentScorer = scorer;
Modified: lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/QueryScorer.java Thu Oct 25 13:10:25 2012
@@ -84,7 +84,6 @@ public class QueryScorer implements Scor
* @param query to use for highlighting
* @param reader {@link IndexReader} to use for quasi tf/idf scoring
* @param field to highlight - pass null to ignore fields
- * @param defaultField
*/
public QueryScorer(Query query, IndexReader reader, String field, String defaultField) {
this.defaultField = defaultField;
@@ -263,8 +262,6 @@ public class QueryScorer implements Scor
* ensure an efficient reset - if you are already using a different caching
* {@link TokenStream} impl and you don't want it to be wrapped, set this to
* false.
- *
- * @param wrap
*/
public void setWrapIfNotCachingTokenFilter(boolean wrap) {
this.wrapToCaching = wrap;
Modified: lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Scorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Scorer.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Scorer.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/Scorer.java Thu Oct 25 13:10:25 2012
@@ -35,7 +35,7 @@ public interface Scorer {
* @return either a {@link TokenStream} that the Highlighter should continue using (eg
* if you read the tokenSream in this method) or null to continue
* using the same {@link TokenStream} that was passed in.
- * @throws IOException
+ * @throws IOException If there is a low-level I/O error
*/
public TokenStream init(TokenStream tokenStream) throws IOException;
Modified: lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TextFragment.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TextFragment.java?rev=1402140&r1=1402139&r2=1402140&view=diff
==============================================================================
--- lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TextFragment.java (original)
+++ lucene/dev/branches/LUCENE-2878/lucene/highlighter/src/java/org/apache/lucene/search/highlight/TextFragment.java Thu Oct 25 13:10:25 2012
@@ -55,7 +55,6 @@ public class TextFragment
score=Math.max(score,frag2.score);
}
/**
- * @param fragment
* @return true if this fragment follows the one passed
*/
public boolean follows(TextFragment fragment)