lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Israel Tsadok <itsa...@gmail.com>
Subject Re: How to combine QueryParser and Wildcard search
Date Fri, 19 Nov 2010 12:40:13 GMT
I'm not sure what you're trying to do, but it seems to me that your best bet
is to rewrite the query returned from the QueryParser. Just traverse the
BooleanQuery clauses, converting any TermQuery to a WildcardQuery. You can
then have control over what transformation exactly you want to perform.

Israel


On Thu, Nov 18, 2010 at 5:36 PM, Pulkit Singhal <pulkitsinghal@gmail.com>wrote:

> Hello,
>
> I was wondering if there is any API call in Lucene that allows
> something like the following:
>
> Step 1: Take the user input
> "hello world" you are beautiful
>
> Step 2: QueryParser does its thing
> defaultField:hello world defaultField:you defaultField:are
> defaultField:beautiful
>
> Step 3: And somehow a desired transformation like the following one is
> the next thing to happen:
> defaultField:hello world defaultField:you* defaultField:are*
> defaultField:beautiful*
>
> How can I tell QueryParser to throw in the wildcard "*" expression
> where applicable?
>
> You can see that I'm not expecting it to use "*" with something that
> will turn into a phrase query:
> "hello world" becomes defaultField:hello world
> Just the rest of the tokens:
> defaultField:you* defaultField:are* defaultField:beautiful*
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message