lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera" <ser...@gmail.com>
Subject Re: (~) opertor query....
Date Sat, 15 Dec 2007 05:04:07 GMT
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 <hossman_lucene@fucit.org> 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: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Regards,

Shai Erera

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