[ http://issues.apache.org/jira/browse/LUCENE-306?page=all ]
     
Bernhard Messer closed LUCENE-306:
----------------------------------

    Resolution: Fixed
     Assign To:     (was: Lucene Developers)

WildcardQuery doesn't match 'cat' for queries like 'ca??' anylonger.

> [PATCH]multiple wildcards ? at the end of search pattern return incorrect hits
> ------------------------------------------------------------------------------
>
>          Key: LUCENE-306
>          URL: http://issues.apache.org/jira/browse/LUCENE-306
>      Project: Lucene - Java
>         Type: Bug
>   Components: Search
>     Versions: 1.4
>  Environment: Operating System: other
> Platform: Other
>     Reporter: Xiaozheng Ma

>
> 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++;
>              }
> **********************************************************************

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to