apache / apache/lucene

Add minNumberShouldMatch parameter to SpanNearQuery [LUCENE-7434]

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

Description

On the user list, Saar Carmi asked about a new type of SpanQuery that would allow for something like BooleanQuery's minimumNumberShouldMatch

> Given a set of search terms (t1, t2, t3, ti), return all documents where in a sequence of x=10 tokens at least c=3 of the search terms appear within the sequence.

I _think_ we can modify SpanNearQuery fairly easily to accommodate this. I'll submit a PR in the next few days.

![a b c d e f mm=3.PNG](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/a%20b%20c%20d%20e%20f%20mm%3D3.PNG)

![FSA for repeating words.PNG](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/FSA%20for%20repeating%20words.PNG)

---
Migrated from [LUCENE-7434](https://issues.apache.org/jira/browse/LUCENE-7434) by Tim Allison (@tballison), 1 vote, updated Sep 09 2016
Attachments: [a b c d e f mm=3.PNG](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/a%20b%20c%20d%20e%20f%20mm%3D3.PNG) (versions: 2), [AllPairsNearSpans20160902.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/AllPairsNearSpans20160902.patch), [FSA for repeating words.PNG](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/FSA%20for%20repeating%20words.PNG), [TestMinShouldMatchSpan.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7434/TestMinShouldMatchSpan.java) (versions: 2)
Linked issues:
- #4442

Contributor guide

Open the contributing guide

Research direction

Start by reading SpanNearQuery and the attached TestMinShouldMatchSpan.java and AllPairsNearSpans20160902.patch. Determine how the proposed minimumNumberShouldMatch behavior fits the existing span-query model, then add focused tests for the sequence and match-count examples; done means the requested behavior is covered and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
search
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.