lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: a "real" PhrasePrefixQuery
Date Fri, 20 May 2005 11:50:39 GMT
On Friday 20 May 2005 11:30, Stanislav Jordanov wrote:
> Is there a Lucene Query (or something that will do a job) like:
> "Star Wars tri*"
> that will match all docs containing a 3 word phrase: 'Star' followed by 
> 'Wars' followed by a word starting with 'tri'.
> I.e. the above query will match both "Star Wars trilogy" and "Star Wars 
> triumph".

You'll need an ordered SpanNearQuery over the following:
- SpanTermQuery for "Star"
- SpanTermQuery for "Wars"
- SpanOrQuery over all SpanTermQuery's for terms matching tri*.

The last one should be a SpanPrefixQuery, but that one is not
available. Have a look in PrefixQuery.rewrite() on how to find all
terms matching tri*, it's fairly straightforward.

Paul Elschot

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

View raw message