apache / apache/lucene

corner case in MinShouldMatchSumScorer when there are many terms [LUCENE-4873]

Open
#5,938 2 comments 0 reactions 0 assignees View on GitHub
affects-version:4.3 legacy-jira-priority:Major module:core/query/scoring type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

I think this bug is some extreme corner case...

This test currently only uses up to 9 terms. By increasing it to 26 and blasting the test, I was able to uncover a bug.

Here's the seed: ant test -Dtestcase=TestMinShouldMatch2 -Dtests.method=testNextAllTerms -Dtests.seed=E0334C37E6E190D8 -Dtests.slow=true -Dtests.locale=pl_PL -Dtests.timezone=Asia/Thimphu -Dtests.file.encoding=US-ASCII

Here's the patch to make the test use 26 terms.
```
Index: lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java
===================================================================
--- lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java (revision 1459937)
+++ lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java (working copy)
`@@` -56,7 +56,7 `@@`
static final String alwaysTerms[] = { "a" };
static final String commonTerms[] = { "b", "c", "d" };
static final String mediumTerms[] = { "e", "f", "g" };
- static final String rareTerms[] = { "h", "i", "j" };
+ static final String rareTerms[] = { "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };

`@Override`
public void setUp() throws Exception {
```

---
Migrated from [LUCENE-4873](https://issues.apache.org/jira/browse/LUCENE-4873) by Robert Muir (@rmuir), updated Mar 24 2013
Attachments: [LUCENE-4873.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-4873/LUCENE-4873.patch)

Contributor guide

Open the contributing guide

Research direction

Start by running TestMinShouldMatch2.testNextAllTerms with the supplied seed and the 26-term change in lucene/core/src/test/org/apache/lucene/search/TestMinShouldMatch2.java. Then inspect MinShouldMatchSumScorer to isolate the many-term corner case. Done means the seeded test passes and the expanded-term regression remains covered.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.