lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: Can Span Queries contain boolean, prefix and other component queries?
Date Sun, 04 Sep 2005 20:11:59 GMT

On Sunday 04 September 2005 20:43, Sean O'Connor wrote:
> Hello,
>     I am trying to do some complex queries such as:
> [Field contents]
> The movie Napoleon Dynamite is a movie about a kid named Napoleon who 
> has no Dynamite.
> [Query]
> "Napol* Dynamite" near "film|movie"
>     Is this possible with some version of a span query? Something like a 
> PhrasePrefixQuery joined to a BooleanQuery by a SpanNearQuery?

This can be done using nested SpanNearQuery's and SpanOrQuery's.
A PhrasePrefixQuery can not be used as a SpanQuery.

>     If not, does anyone have a suggestion on how to do this? I am 
> assuming I will need to do two queries, and determine the 'nearness' of 
> the resulting hits myself.
> Thanks,

You can do this using the surround query language:

(Napol* w dynamite) n (film or movie)

The surround parser will construct the nested span queries.
The surround query language is in the contrib/surround directory
in the development version. The most striking difference with
the lucene standard query language is that all operators 
have to be given explicitly, there is no implicit 'and' or 'or'.

Paul Elschot

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

View raw message