lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Problem using wildcardsearch in phrase search
Date Sun, 13 May 2007 00:05:11 GMT
This just keeps running around in my head...

I was wrong on one point...if you use the KeywordAnalyzer and you put 
your search in quotes then you will not generate a phrase query because 
a PhraseQuery is only generated if the analyzer produces more than one 
token. The problem is that, instead of a PhraseQuery, a TermQuery is 
generated. You don't get to the wildcard handling part of the parser...a 
TermQuery is returned. The QueryParser's javacc syntax will not 
recognize wildcards in quotes and the handling for a quoted token does 
not check for wildcards.

You might try an override in 'Query getFieldQuery(String field, String 
queryText)' that scans the token for a wildcard and if it finds one, 
generate a wildcard query instead of a termquery.

- Mark

Paul Taylor wrote:
> Mark Miller wrote:
>> Didn't you say you where using a phrasequery? If you are, things will 
>> not work as expected. You need to leave the quotes out of your search 
>> as a phrasequery will not match what you are putting in your index. 
>> If you are not using a phrasequery then things should work as you 
>> would expect. Can you provide any other info?
>>
>> - Mark
>
> No, I meant I was parsing a search String of the form 
> fieldname:"MusicIP Puid*" (because I was using quotes and it is 
> surrounded by double quotes I called it a phrase query), then I use 
> the QueryParser().parse() to convert this search string into a Query 
> (as shown in the code I posted earlier)
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

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


Mime
View raw message