You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Dan Armbrust <da...@gmail.com> on 2006/09/25 22:20:30 UTC

wildcards in quoted phrases?

I have someone wanting to do a query like this - "top sta*", but from 
what I have been able to gather, lucene doesn't have any built in 
support for wildcards inside of phrases?

Well, at least not complete support.  I was led to the MultiPhraseQuery 
class - but looking at that leaves me wondering - has anyone written (or 
modified) a QueryParser that can automatically use this?

Or do I have to manually create the query whenever I encounter a quoted 
phrase with a wildcard?  My hunch is that its not real easy, otherwise 
it would already have been done...

Thanks,

Dan


-- 
****************************
Daniel Armbrust
Biomedical Informatics
Mayo Clinic Rochester
daniel.armbrust(at)mayo.edu
http://informatics.mayo.edu/

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


RE: wildcards in quoted phrases?

Posted by Le...@emc.com.
I encountered this issue before and was led to use SpanQueries for
wildcards within phrases. Take a look at the SpanQuery family of
classes. SpanQueries can give you the ability to specify a wildcarded
term within a phrase since you can nest different SpanQueries within a
SpanQuery. One of these is the SpanRegexQuery, which allows you to
specify a regular expression that would serve as your wildcard term
search within the phrase. 

I ended up using a SpanNearQuery to represent the overall phrase nested
with SpanRegexQueries for the wildcarded parts, and SpanTermQueries for
all other non-wildcarded terms. 

Hope this helps,
Gary

-----Original Message-----
From: Daniel Naber [mailto:lucenelist2005@danielnaber.de] 
Sent: Monday, September 25, 2006 01:45 PM
To: java-user@lucene.apache.org
Subject: Re: wildcards in quoted phrases?

On Monday 25 September 2006 22:20, Dan Armbrust wrote:

> My hunch is that its not real easy, otherwise it would already have 
> been done...

I think it shouldn't be difficult, but to expand the PrefixQuery, your
QueryParser would need an IndexReader. Currently IndexReader/QueryParser
don't depend on each other. Maybe this is the reason why it hasn't been
done or why it hasn't been published.

Regards
 Daniel

--
http://www.danielnaber.de

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


Re: wildcards in quoted phrases?

Posted by Daniel Naber <lu...@danielnaber.de>.
On Monday 25 September 2006 22:20, Dan Armbrust wrote:

> My hunch is that its not real easy, otherwise
> it would already have been done...

I think it shouldn't be difficult, but to expand the PrefixQuery, your 
QueryParser would need an IndexReader. Currently IndexReader/QueryParser 
don't depend on each other. Maybe this is the reason why it hasn't been 
done or why it hasn't been published.

Regards
 Daniel

-- 
http://www.danielnaber.de

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