fix to prevent that queries like 'ca??' match a term like 'cat'.

Terms with the correct length should be returned only. See Bug#LUCENE-306

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@329859 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bernhard Messer 2005-10-31 17:05:36 +00:00
parent 741173ade6
commit 34e42624f6
1 changed files with 6 additions and 1 deletions

View File

@ -125,15 +125,20 @@ public class WildcardTermEnum extends FilteredTermEnum {
{
// Check the character at the current position
char wildchar = pattern.charAt(wildcardSearchPos);
// If it's not a wildcard character, then there is more
// pattern information after this/these wildcards.
if (wildchar != WILDCARD_CHAR && wildchar != WILDCARD_STRING)
{
justWildcardsLeft = false;
}
else
{
// to prevent "cat" matches "ca??"
if (wildchar == WILDCARD_CHAR) {
return false;
}
// Look at the next character
wildcardSearchPos++;
}