apache / apache/lucene

Nested Span Queries are buggy [LUCENE-7398]

Open
#8,451 37 comments 0 reactions 1 assignee Claimed by @romseygeek View on GitHub
affects-version:5.5 legacy-jira-priority:Critical module:core/search type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

Example for a nested SpanQuery that is not working:

Document: Human Genome Organization , HUGO , is trying to coordinate gene mapping research worldwide.

Query: spanNear([body:coordinate, spanOr([spanNear([body:gene, body:mapping], 0, true), body:gene]), body:research], 0, true)

The query should match "coordinate gene mapping research" as well as "coordinate gene research". It does not match "coordinate gene mapping research" with Lucene 5.5 or 6.1, it did however match with Lucene 4.10.4. It probably stopped working with the changes on SpanQueries in 5.3. I will attach a unit test that shows the problem.

---
Migrated from [LUCENE-7398](https://issues.apache.org/jira/browse/LUCENE-7398) by Christoph Goller, 15 votes, updated May 31 2022
Attachments: [LUCENE-7398.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7398/LUCENE-7398.patch) (versions: 3), [LUCENE-7398-20160814.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7398/LUCENE-7398-20160814.patch), [LUCENE-7398-20160924.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7398/LUCENE-7398-20160924.patch), [LUCENE-7398-20160925.patch](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7398/LUCENE-7398-20160925.patch), [TestSpanCollection.java](https://apache.github.io/lucene-jira-archive/attachments/LUCENE-7398/TestSpanCollection.java)
Linked issues:
- [SOLR-14453](https://issues.apache.org/jira/browse/SOLR-14453)
- #9741
- #8899
- #6395

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.