lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bmes...@apache.org
Subject svn commit: r329859 - /lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java
Date Mon, 31 Oct 2005 17:05:39 GMT
Author: bmesser
Date: Mon Oct 31 09:05:36 2005
New Revision: 329859

URL: http://svn.apache.org/viewcvs?rev=329859&view=rev
Log:
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

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java?rev=329859&r1=329858&r2=329859&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/WildcardTermEnum.java Mon Oct 31 09:05:36
2005
@@ -125,15 +125,20 @@
           {
             // 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++;
             }



Mime
View raw message