LUCENE-5313: leave the default to true for enablePositionIncrements

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1537104 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2013-10-30 14:23:07 +00:00
parent cd49552b57
commit fe4699b6b0
4 changed files with 28 additions and 28 deletions

View File

@ -190,19 +190,19 @@ public class AnalyzingSuggester extends Lookup {
/** /**
* Calls {@link #AnalyzingSuggester(Analyzer,Analyzer,int,int,int,boolean) * Calls {@link #AnalyzingSuggester(Analyzer,Analyzer,int,int,int,boolean)
* AnalyzingSuggester(analyzer, analyzer, EXACT_FIRST | * AnalyzingSuggester(analyzer, analyzer, EXACT_FIRST |
* PRESERVE_SEP, 256, -1, false)} * PRESERVE_SEP, 256, -1, true)}
*/ */
public AnalyzingSuggester(Analyzer analyzer) { public AnalyzingSuggester(Analyzer analyzer) {
this(analyzer, analyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, false); this(analyzer, analyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, true);
} }
/** /**
* Calls {@link #AnalyzingSuggester(Analyzer,Analyzer,int,int,int,boolean) * Calls {@link #AnalyzingSuggester(Analyzer,Analyzer,int,int,int,boolean)
* AnalyzingSuggester(indexAnalyzer, queryAnalyzer, EXACT_FIRST | * AnalyzingSuggester(indexAnalyzer, queryAnalyzer, EXACT_FIRST |
* PRESERVE_SEP, 256, -1, false)} * PRESERVE_SEP, 256, -1, true)}
*/ */
public AnalyzingSuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer) { public AnalyzingSuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer) {
this(indexAnalyzer, queryAnalyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, false); this(indexAnalyzer, queryAnalyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, true);
} }
/** /**

View File

@ -124,7 +124,7 @@ public final class FuzzySuggester extends AnalyzingSuggester {
* Analyzer that will be used for analyzing query text during lookup * Analyzer that will be used for analyzing query text during lookup
*/ */
public FuzzySuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer) { public FuzzySuggester(Analyzer indexAnalyzer, Analyzer queryAnalyzer) {
this(indexAnalyzer, queryAnalyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, false, DEFAULT_MAX_EDITS, DEFAULT_TRANSPOSITIONS, this(indexAnalyzer, queryAnalyzer, EXACT_FIRST | PRESERVE_SEP, 256, -1, true, DEFAULT_MAX_EDITS, DEFAULT_TRANSPOSITIONS,
DEFAULT_NON_FUZZY_PREFIX, DEFAULT_MIN_FUZZY_LENGTH, DEFAULT_UNICODE_AWARE); DEFAULT_NON_FUZZY_PREFIX, DEFAULT_MIN_FUZZY_LENGTH, DEFAULT_UNICODE_AWARE);
} }

View File

@ -254,7 +254,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
int options = 0; int options = 0;
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, options, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, options, 256, -1, true);
suggester.build(new InputArrayIterator(keys)); suggester.build(new InputArrayIterator(keys));
// TODO: would be nice if "ab " would allow the test to // TODO: would be nice if "ab " would allow the test to
// pass, and more generally if the analyzer can know // pass, and more generally if the analyzer can know
@ -460,7 +460,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
Analyzer a = getUnusualAnalyzer(); Analyzer a = getUnusualAnalyzer();
int options = AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP; int options = AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP;
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, options, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, options, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("x y", 1), new Input("x y", 1),
new Input("x y z", 3), new Input("x y z", 3),
@ -499,7 +499,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
public void testNonExactFirst() throws Exception { public void testNonExactFirst() throws Exception {
Analyzer a = getUnusualAnalyzer(); Analyzer a = getUnusualAnalyzer();
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("x y", 1), new Input("x y", 1),
@ -753,7 +753,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
Analyzer a = new MockTokenEatingAnalyzer(numStopChars, preserveHoles); Analyzer a = new MockTokenEatingAnalyzer(numStopChars, preserveHoles);
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester suggester = new AnalyzingSuggester(a, a,
preserveSep ? AnalyzingSuggester.PRESERVE_SEP : 0, 256, -1, false); preserveSep ? AnalyzingSuggester.PRESERVE_SEP : 0, 256, -1, true);
if (doPayloads) { if (doPayloads) {
suggester.build(new InputArrayIterator(shuffle(payloadKeys))); suggester.build(new InputArrayIterator(shuffle(payloadKeys)));
} else { } else {
@ -874,7 +874,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
public void testMaxSurfaceFormsPerAnalyzedForm() throws Exception { public void testMaxSurfaceFormsPerAnalyzedForm() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 2, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 2, -1, true);
suggester.build(new InputArrayIterator(shuffle(new Input("a", 40), suggester.build(new InputArrayIterator(shuffle(new Input("a", 40),
new Input("a ", 50), new Input(" a", 60)))); new Input("a ", 50), new Input(" a", 60))));
@ -888,7 +888,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
public void testQueueExhaustion() throws Exception { public void testQueueExhaustion() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.EXACT_FIRST, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.EXACT_FIRST, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("a", 2), new Input("a", 2),
@ -904,7 +904,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.EXACT_FIRST, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.EXACT_FIRST, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("a", 5), new Input("a", 5),
@ -969,7 +969,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
} }
}; };
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, true);
suggester.build(new InputArrayIterator(shuffle( suggester.build(new InputArrayIterator(shuffle(
new Input("hambone", 6), new Input("hambone", 6),
@ -1038,7 +1038,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
} }
}; };
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("a", 6), new Input("a", 6),
@ -1111,7 +1111,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
} }
}; };
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("a a", 50), new Input("a a", 50),
@ -1121,7 +1121,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
public void testDupSurfaceFormsMissingResults3() throws Exception { public void testDupSurfaceFormsMissingResults3() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("a a", 7), new Input("a a", 7),
new Input("a a", 7), new Input("a a", 7),
@ -1134,7 +1134,7 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
public void testEndingSpace() throws Exception { public void testEndingSpace() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("i love lucy", 7), new Input("i love lucy", 7),
new Input("isla de muerta", 8), new Input("isla de muerta", 8),
@ -1167,14 +1167,14 @@ public class AnalyzingSuggesterTest extends LuceneTestCase {
} }
}; };
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, 1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, 1, true);
suggester.build(new InputArrayIterator(new Input[] {new Input("a", 1)})); suggester.build(new InputArrayIterator(new Input[] {new Input("a", 1)}));
assertEquals("[a/1]", suggester.lookup("a", false, 1).toString()); assertEquals("[a/1]", suggester.lookup("a", false, 1).toString());
} }
public void testIllegalLookupArgument() throws Exception { public void testIllegalLookupArgument() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, false); AnalyzingSuggester suggester = new AnalyzingSuggester(a, a, 0, 256, -1, true);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("а где Люси?", 7), new Input("а где Люси?", 7),
})); }));

View File

@ -61,7 +61,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
} }
keys.add(new Input("foo bar boo far", 12)); keys.add(new Input("foo bar boo far", 12));
MockAnalyzer analyzer = new MockAnalyzer(random(), MockTokenizer.KEYWORD, false); MockAnalyzer analyzer = new MockAnalyzer(random(), MockTokenizer.KEYWORD, false);
FuzzySuggester suggester = new FuzzySuggester(analyzer, analyzer, FuzzySuggester.EXACT_FIRST | FuzzySuggester.PRESERVE_SEP, 256, -1, false, FuzzySuggester.DEFAULT_MAX_EDITS, FuzzySuggester.DEFAULT_TRANSPOSITIONS, FuzzySuggester suggester = new FuzzySuggester(analyzer, analyzer, FuzzySuggester.EXACT_FIRST | FuzzySuggester.PRESERVE_SEP, 256, -1, true, FuzzySuggester.DEFAULT_MAX_EDITS, FuzzySuggester.DEFAULT_TRANSPOSITIONS,
0, FuzzySuggester.DEFAULT_MIN_FUZZY_LENGTH, FuzzySuggester.DEFAULT_UNICODE_AWARE); 0, FuzzySuggester.DEFAULT_MIN_FUZZY_LENGTH, FuzzySuggester.DEFAULT_UNICODE_AWARE);
suggester.build(new InputArrayIterator(keys)); suggester.build(new InputArrayIterator(keys));
int numIters = atLeast(10); int numIters = atLeast(10);
@ -82,7 +82,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
} }
keys.add(new Input("фуу бар буу фар", 12)); keys.add(new Input("фуу бар буу фар", 12));
MockAnalyzer analyzer = new MockAnalyzer(random(), MockTokenizer.KEYWORD, false); MockAnalyzer analyzer = new MockAnalyzer(random(), MockTokenizer.KEYWORD, false);
FuzzySuggester suggester = new FuzzySuggester(analyzer, analyzer, FuzzySuggester.EXACT_FIRST | FuzzySuggester.PRESERVE_SEP, 256, -1, false, FuzzySuggester.DEFAULT_MAX_EDITS, FuzzySuggester.DEFAULT_TRANSPOSITIONS, FuzzySuggester suggester = new FuzzySuggester(analyzer, analyzer, FuzzySuggester.EXACT_FIRST | FuzzySuggester.PRESERVE_SEP, 256, -1, true, FuzzySuggester.DEFAULT_MAX_EDITS, FuzzySuggester.DEFAULT_TRANSPOSITIONS,
0, FuzzySuggester.DEFAULT_MIN_FUZZY_LENGTH, true); 0, FuzzySuggester.DEFAULT_MIN_FUZZY_LENGTH, true);
suggester.build(new InputArrayIterator(keys)); suggester.build(new InputArrayIterator(keys));
int numIters = atLeast(10); int numIters = atLeast(10);
@ -208,7 +208,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
int options = 0; int options = 0;
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
FuzzySuggester suggester = new FuzzySuggester(a, a, options, 256, -1, false, 1, true, 1, 3, false); FuzzySuggester suggester = new FuzzySuggester(a, a, options, 256, -1, true, 1, true, 1, 3, false);
suggester.build(new InputArrayIterator(keys)); suggester.build(new InputArrayIterator(keys));
// TODO: would be nice if "ab " would allow the test to // TODO: would be nice if "ab " would allow the test to
// pass, and more generally if the analyzer can know // pass, and more generally if the analyzer can know
@ -417,7 +417,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
public void testExactFirst() throws Exception { public void testExactFirst() throws Exception {
Analyzer a = getUnusualAnalyzer(); Analyzer a = getUnusualAnalyzer();
FuzzySuggester suggester = new FuzzySuggester(a, a, AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP, 256, -1, false, 1, true, 1, 3, false); FuzzySuggester suggester = new FuzzySuggester(a, a, AnalyzingSuggester.EXACT_FIRST | AnalyzingSuggester.PRESERVE_SEP, 256, -1, true, 1, true, 1, 3, false);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("x y", 1), new Input("x y", 1),
new Input("x y z", 3), new Input("x y z", 3),
@ -456,7 +456,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
public void testNonExactFirst() throws Exception { public void testNonExactFirst() throws Exception {
Analyzer a = getUnusualAnalyzer(); Analyzer a = getUnusualAnalyzer();
FuzzySuggester suggester = new FuzzySuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, false, 1, true, 1, 3, false); FuzzySuggester suggester = new FuzzySuggester(a, a, AnalyzingSuggester.PRESERVE_SEP, 256, -1, true, 1, true, 1, 3, false);
suggester.build(new InputArrayIterator(new Input[] { suggester.build(new InputArrayIterator(new Input[] {
new Input("x y", 1), new Input("x y", 1),
@ -683,7 +683,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
Analyzer a = new MockTokenEatingAnalyzer(numStopChars, preserveHoles); Analyzer a = new MockTokenEatingAnalyzer(numStopChars, preserveHoles);
FuzzySuggester suggester = new FuzzySuggester(a, a, FuzzySuggester suggester = new FuzzySuggester(a, a,
preserveSep ? AnalyzingSuggester.PRESERVE_SEP : 0, 256, -1, false, 1, false, 1, 3, unicodeAware); preserveSep ? AnalyzingSuggester.PRESERVE_SEP : 0, 256, -1, true, 1, false, 1, 3, unicodeAware);
suggester.build(new InputArrayIterator(keys)); suggester.build(new InputArrayIterator(keys));
for (String prefix : allPrefixes) { for (String prefix : allPrefixes) {
@ -823,7 +823,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
public void testMaxSurfaceFormsPerAnalyzedForm() throws Exception { public void testMaxSurfaceFormsPerAnalyzedForm() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
FuzzySuggester suggester = new FuzzySuggester(a, a, 0, 2, -1, false, 1, true, 1, 3, false); FuzzySuggester suggester = new FuzzySuggester(a, a, 0, 2, -1, true, 1, true, 1, 3, false);
List<Input> keys = Arrays.asList(new Input[] { List<Input> keys = Arrays.asList(new Input[] {
new Input("a", 40), new Input("a", 40),
@ -844,7 +844,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
public void testEditSeps() throws Exception { public void testEditSeps() throws Exception {
Analyzer a = new MockAnalyzer(random()); Analyzer a = new MockAnalyzer(random());
FuzzySuggester suggester = new FuzzySuggester(a, a, FuzzySuggester.PRESERVE_SEP, 2, -1, false, 2, true, 1, 3, false); FuzzySuggester suggester = new FuzzySuggester(a, a, FuzzySuggester.PRESERVE_SEP, 2, -1, true, 2, true, 1, 3, false);
List<Input> keys = Arrays.asList(new Input[] { List<Input> keys = Arrays.asList(new Input[] {
new Input("foo bar", 40), new Input("foo bar", 40),
@ -958,7 +958,7 @@ public class FuzzySuggesterTest extends LuceneTestCase {
boolean transpositions = random().nextBoolean(); boolean transpositions = random().nextBoolean();
// TODO: test graph analyzers // TODO: test graph analyzers
// TODO: test exactFirst / preserveSep permutations // TODO: test exactFirst / preserveSep permutations
FuzzySuggester suggest = new FuzzySuggester(a, a, 0, 256, -1, false, maxEdits, transpositions, prefixLen, prefixLen, false); FuzzySuggester suggest = new FuzzySuggester(a, a, 0, 256, -1, true, maxEdits, transpositions, prefixLen, prefixLen, false);
if (VERBOSE) { if (VERBOSE) {
System.out.println("TEST: maxEdits=" + maxEdits + " prefixLen=" + prefixLen + " transpositions=" + transpositions + " num=" + NUM); System.out.println("TEST: maxEdits=" + maxEdits + " prefixLen=" + prefixLen + " transpositions=" + transpositions + " num=" + NUM);