I don't really use Span queries, but this strieks me as being very similar
to past discussions about using Span queries along with "sentinel" terms
to find words in the same sentence or paragraph.

If you had a a special Term indexed at the end of every document, you
could do something like this...

    spanNot(spanNear(spanNear(A,B,slop),END_TERM,Infinity),C)

..which would be close to what you want (except that it would only match
on documents where A and B were close together, and C didnt' come after
them ... it wouldn't match on docuemnts where C came after them but it was
very far after them)

It does suggest however that you could possibly write a new SpanQuery that
took in a sub-SpanQuery, and an uper bound "limit" and generated Spans
that started with the Spans from the sub-query, and reached as far out as the 
limit
allowed, in which case you could do something like...

    spanNot(spanLimit(spanNear(A,B,slop),slop),C)

..however I've never tried writing a SpanQuery -- and the SpanQuery
internals I've tried to understand have severely frightened me ... so i
you pursue this endever I wish you the best of luck.


: Date: Thu, 22 Jun 2006 16:43:39 -0400
: From: Ben Knear <[EMAIL PROTECTED]>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: A Special SpanQuery
:
: I am trying to make a SpanNearQuery that will contain a SpanNotQuery and
: running into a bit of difficulty. Has anyone worked with creating a
: variation of a SpanQuery or using special logic to make this work?
: For example - (A B !C) in order with a slop of 1 should return results
: with A and B within 1 slop of each other and not have C after B within
: the slop left over from A to B. With this rule, A B E M F would return
: true, while A B E C J would be false.
: Thanks!
: Ben
:
: ---------------------------------------------------------------------
: To unsubscribe, e-mail: [EMAIL PROTECTED]
: For additional commands, e-mail: [EMAIL PROTECTED]
:



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to