lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
Subject Re: A Special SpanQuery
Date Fri, 23 Jun 2006 07:30:50 GMT
On Friday 23 June 2006 00:15, Chris Hostetter wrote:
> 
> 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)

See below for a slightly different take on this.

> 
> ..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 <knearb@pf-cvl.net>
> : 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?

Not that I know, but the current SpanQueries indeed can't do this.

> : 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.

One could also add slop to SpanNotQuery, like this:

SpanNot(SpanNear(A, B, nearSlop), C, notSlop)

It would need a special notSlop value (-1 ?) for the current behaviour
of SpanNotQuery that only inhibits matches when there is some overlap.
Even smaller values for notSlop might be useful to require more embedding
before inhibiting the match.

Regards,
Paul Elschot

---------------------------------------------------------------------
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