You can look at org.apache.lucene.search.MultiPhraseQuery which does
something similar to what you ask. From its javadoc:

 * To use this class, to search for the phrase "Microsoft app*" first use
 * add(Term) on the term "Microsoft", then find all terms that have "app" as
 * prefix using IndexReader.terms(Term), and use MultiPhraseQuery.add(Term[]
 * terms) to add them to the query.

It works for simple phrases and I don't know if it works for fuzzy phrases
as well ... however I believe it can be tweaked to work for fuzzy phrases
also.

On Dec 15, 2007 1:26 AM, Chris Hostetter <[EMAIL PROTECTED]> wrote:

>
> :           I am parsing this query:  "Auto*  machine"~4.
> :
> :           Will it work? If yes then right now it's not working. Can
> : anyone help on this?
>
> Tt depends, what do you want it to do?  :)
>
> If you are hoping it will match documents that contain a word that starts
> with "Auto" withing a distance of 4 words from the word "machine" then no,
> the query parser doesn't work that way.  phrase queries (aka: proximty
> queries) as supported by the QueryParser can only match simple words in
> the phrase, not other complex query types ... but you could build your own
> query parser that leveraged the SpanQuery family of queries to do
> something like this.
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
Regards,

Shai Erera

Reply via email to