lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: MultiSearcher GUI? Before/After query?
Date Wed, 18 May 2005 21:23:07 GMT

: 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

SpanNearQuery should do what you want, something like this in psuedo

  Query q = new SpanNearQuery(
             new SpanNearQuery(new SpanTermQuery(Nobel),
                               new SpanTermQuery(Prize),
                               new SpanTermQuery(Winer),
                               slop=1, inOrder=true),
             new SpanNearQuery(new SpanTermQuery(Roger),
                               new SpanTermQuery(Penrose),
                               slop=1, inOrder=true),
             new SpanNearQuery(new SpanTermQuery(Superstring),
                               new SpanTermQuery(Theor),
                               slop=1, inOrder=true),
             slop=1000000000, inOrder=true);


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

View raw message