apache / apache/lucene

Support for a "SpanNotNearQuery" [LUCENE-3370]

Open
#4,443 6 comments 0 reactions 0 assignees View on GitHub
legacy-jira-priority:Major module:core/search type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Sometimes you want to find an instance of a span which does not hit near some other span query. SpanNotQuery only excludes exact hits on the term, but sometimes you want to exclude hits 1 away from the first, and other times you might want the range to be wider.

So a SpanNotNearQuery could be useful.

SpanNotQuery is actually very close, and adding slop+inOrder support to it is probably sufficient to make a SpanNotNearQuery. :)

There appears to be one project which has done it in this fashion, although this particular code looks like it's out of date:

http://www.koders.com/java/fid933A84488EBE1F3492B19DE01B2A4FC1D68DA258.aspx?s=ArrayQuery

---
Migrated from [LUCENE-3370](https://issues.apache.org/jira/browse/LUCENE-3370) by Trejkaz, updated Sep 13 2016
Linked issues:
- #6155

Contributor guide

Open the contributing guide

Research direction

Start by reading SpanNotQuery and the linked issue #6155 to understand the proposed SpanNotNearQuery behavior. Determine how slop and inOrder should apply to excluded span hits, then identify the relevant span-query tests and add coverage showing the supported distance and ordering cases. Done means the new query behavior is defined, implemented, and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.