You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Xiaozheng Ma <Xi...@redwood.com> on 2004/11/08 21:18:20 UTC

[PATCH] wildcard "?" bug: "cat" matches "ca??"

Dear all,
 
I am not a lucene dev subscriber and hope you can see this email. It is
an intention to patch a bug that is related to multiple(continuous)
trailing wildcards "?". For example "cat" will match "ca??" .
 
The problem is at the file
org.apache.lucene.search.WildcardTermEnum.java (referring to current src
download from apache), line 135. three line is added:
                  //to prevent "cat" matches "ca??"
                  if(wildchar == WILDCARD_CHAR){
                        return false;
                  }           
 
To provide some context:
...
            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++;
            }
          }
...
 
A patch file is attached. 
 
Thanks!
 
---
Xiaozheng Ma