lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Cutting <cutt...@apache.org>
Subject Re: query across fields?
Date Tue, 11 Oct 2005 19:05:25 GMT
Marc Hadfield wrote:
> In the SpanNear (or for that matter PhraseQuery), one can set a slop 
> value where 0 (zero) means one following after the other.
> 
> How can one differentiate between Terms at the **same** position vs. one 
> after the other?

The following queries only match "x" and "y" at the same position:

Query pq = new PhraseQuery();
pq.add(new Term("f", "x"), 0);
pq.add(new Term("f", "y"), 0);

Query sq =
   new SpanNearQuery(new SpanQuery[]
                       { new SpanTermQuery(new Term("f", "x")),
                         new SpanTermQuery(new Term("f", "y")) },
                     0, false);

Doug

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message