lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: MultiSearcher GUI? Before/After query?
Date Wed, 18 May 2005 19:34:20 GMT

On May 18, 2005, at 2:33 PM, KW Kor wrote:
> On another note, is there any support for before/after phrase  
> queries? I need to
> construct a query that is able to search for documents where  
> specific phrases
> must appear in a fixed order in a document. For example, "Nobel  
> Prize" must
> occurr before "Roger Penrose" which must occurr before "Superstring  
> Theory". So
> the query would match "Nobel Prize winner, Roger Penrose, today  
> published a
> paper on Superstring Theory", but would not match "Roger Penrose today
> published a paper on Superstring Theory. A Nobel Prize winner, ..."

The SpanQuery family of queries will do exactly this.  Each term  
becomes a SpanTermQuery (rather than using a PhraseQuery) and then  
each phrase is a SpanNearQuery, and then nest those in another  
ordered SpanNearQuery with whatever distance you want to allow and  
whether it should be ordered or not ordered.

> Btw, its great to see Lucene grow from its old SourceForge roots to  
> a top level
> project at Thanks for keeping my name on the "Who we  
> are" page even
> though I have not contributed in years. Hello Doug, Otis, et al.

Welcome back!!!


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

View raw message