You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Shay Hummel <sh...@gmail.com> on 2015/04/14 19:24:39 UTC

Span near query with payloads

Hi

Why did you add this note in SpanPayloadCheckQuery
"Do not use this with an SpanQuery that contains a SpanNearQuery
<http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/search/spans/SpanNearQuery.html>.
Instead, use SpanNearPayloadCheckQuery
<http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/search/spans/SpanNearPayloadCheckQuery.html>
since
it properly handles the fact that payloads aren't ordered by SpanNearQuery
<http://lucene.apache.org/core/4_10_2/core/org/apache/lucene/search/spans/SpanNearQuery.html>."
?
I used SpanNearQuery and provided, as its clauses[], an array of
SpanPayloadCheckQuery and it seems to work OK?

What I am trying to do is search terms in a certain window which each term
has its own payload. I use the payload to code part of speech.

for example:
Doc1: I booked a flight. (booked is a verb, flight is a noun)
Doc2: I read the book the Hobbit during the flight to London. (book is a
noun, flight is a noun)

when I searched "book flight" with (verb and noun as payload respectively)
it worked for the correct window (depends If i removed stopwords or
not) properly.

So what did you mean with this note?

Thank you,

Shay Hummel