lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <>
Subject Re: Proximity of More than Single Words?
Date Tue, 19 Jan 2010 17:26:34 GMT
> For proximity expressions, the query
> parser documentation says, "use the tilde, "~", symbol at
> the end of a Phrase." It gives the example "jakarta
> apache"~10
> Does this mean that proximity can only be operated on
> single words enquoted in quotation marks?

Yes if you are using QueryParser to generate your queries. It does not support nested proximity.
But if you are constructing your queries programmatically it can be done with SpanQuery family.

> To clarify the
> question by comparision, on some systems, the w/ proximity
> operator lets one search for:
> crude w/4 "west texas"
> or
> "spot prices" w/3 "gulf coast"

There is a org.apache.lucene.queryParser.surround.parser.QueryParser that supports nested
proximity search. However it's syntax does not use quotes. There are two operators ordered
(w) and unordered (n). Your examples can be translated as follows:

crude 4w (west w texax)

(spot w prices) 3w (gulf w coast)

Also surround parser do not analyze query words. There are different query parsers here:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message