mirror of https://github.com/apache/lucene.git
fix lookupWord false positive
This commit is contained in:
parent
7b048c5610
commit
469cfc67d4
|
@ -191,7 +191,7 @@ class WordStorage {
|
||||||
return i == 0;
|
return i == 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return length == 0;
|
return length == 0 && dataPos == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readForms(IntsRef forms, ByteArrayDataInput in, int length) {
|
private void readForms(IntsRef forms, ByteArrayDataInput in, int length) {
|
||||||
|
|
|
@ -50,6 +50,10 @@ public class TestDictionary extends LuceneTestCase {
|
||||||
assertNotNull(ordList);
|
assertNotNull(ordList);
|
||||||
assertEquals(1, ordList.length);
|
assertEquals(1, ordList.length);
|
||||||
assertEquals('A', assertSingleFlag(dictionary, ordList));
|
assertEquals('A', assertSingleFlag(dictionary, ordList));
|
||||||
|
|
||||||
|
assertNotNull(dictionary.lookupWord(new char[] {'a', 'b'}, 0, 2));
|
||||||
|
assertNotNull(dictionary.lookupWord(new char[] {'d', 'b'}, 0, 2));
|
||||||
|
assertNull(dictionary.lookupWord(new char[] {'b'}, 0, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static char assertSingleFlag(Dictionary dictionary, IntsRef ordList) {
|
private static char assertSingleFlag(Dictionary dictionary, IntsRef ordList) {
|
||||||
|
|
|
@ -8,3 +8,4 @@ lucene
|
||||||
mahout/A
|
mahout/A
|
||||||
moo/E
|
moo/E
|
||||||
olr/B
|
olr/B
|
||||||
|
db
|
Loading…
Reference in New Issue