lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32167] New: - [PATCH]multiple wildcards ? at the end of search pattern return incorrect hits
Date Wed, 10 Nov 2004 19:00:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32167>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32167

 [PATCH]multiple wildcards ? at the end of search pattern return incorrect hits

           Summary:  [PATCH]multiple wildcards ? at the end of search
                    pattern return incorrect hits
           Product: Lucene
           Version: 1.4
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Search
        AssignedTo: lucene-dev@jakarta.apache.org
        ReportedBy: xiaozheng.ma@redwood.com


The problem is if you search on "ca??", the hit includes 'cat', 'CA', 
etc, while the user only wants 4 letter words start with CA, such as 
'card', 'cash', to be returned. This happens only when multiple '?' at 
the end of search pattern. The solution is to check if the word that is 
matching against search pattern ends while there is still '?' left. If 
this is the case, match should return false.

Attached is the patch code I generated use 'diff'
********************************************************************

--- WildcardTermEnum.org	2004-05-11 11:42:10.000000000 -0400
+++ WildcardTermEnum.java	2004-11-08 14:35:14.823610500 -0500
@@ -132,6 +132,10 @@
             }
             else
             {
+	      //to prevent "cat" matches "ca??"
+	      if(wildchar == WILDCARD_CHAR){
+		return false;
+	      }	      
               // Look at the next character
               wildcardSearchPos++;
             }
**********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message