lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: wildcards in phrase searches
Date Wed, 10 May 2006 17:59:44 GMT

On May 10, 2006, at 1:47 PM, Lee_Gary@emc.com wrote:

> Is it possible to have wildcards in a phrase search? For example,  
> if my
> object is indexed with a phrase "benchmark properties", is there a  
> way to
> specify a phrase search that uses wildcards, such as "benchmar*  
> properties"
> or "benchmark pro*"? I have tried using WildcardQuery, but it  
> doesnt seem to
> work with phrases, only single terms. Using the QueryParser doesnt  
> seem to
> work either, and ive tried it with the StandardAnalyzer and  
> KeywordAnalyzer.
> Perhaps there is something simple Im missing here. Has anyone  
> gotten this to
> work?

It's a fair bit trickier than using any of the stock core classes  
like that.  But it can be done, using SpanNearQuery nested with  
SpanRegexQuery's for the wildcarded parts in the contrib code (note,  
this uses regex syntax, not WildcardQuery syntax), along with  
SpanTermQuery's for the non-wildcarded parts.

	Erik


---------------------------------------------------------------------
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