开发者

Lucene proximity search with boundaries?

Is there a way to perform a proximity search that is bounded, not by a fixed number of开发者_Python百科 tokens, but by 2 marker tokens of some kind? For example, to implement proximity queries that are bounded inside as single sentence or paragraph? Obviously the analyzer has to support it, but has this been done before, and how?


SpanPositionCheckQuery is an abstract class that defines a span query, which checks if the matched span passes a check for position. Concrete implementations include SpanPositionRangeQuery that checks if the match is in a defined range of positions and SpanPayloadCheckQuery that checks if the payloads of the matched positions are the same as requested.

Maybe you could achieve what you want by assigning a payload to each token indicating to which sentence/paragraph it belongs (with a counter) and then checking if all the payloads of the matched span are equal? I think that extending above class to achieve it should be straightforward.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜