apache / apache/lucene

Search doesn't return document via query [LUCENE-2861]

Open
#3,935 1 comment 0 reactions 0 assignees View on GitHub
affects-version:2.9.1 affects-version:2.9.4 affects-version:3.0.3 legacy-jira-priority:Major module:core/search type:bug
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

The query doesn't return document that contain all words from query in correct order.

The issue might be within mechanism how do SpanQuerys actually match results (http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/)

Please refer for details below. The example text wasn't passed through snowball analyzer, however the issue exists after analyzing too

Query:
(intend within 3 of message) within 5 of message within 3 of addressed.

Text within document:
The contents of this e-mail message and
any attachments are intended solely for the
addressee(s) and may contain confidential
and/or legally privileged information. If you
are not the intended recipient of this message
or if this message has been addressed to you
in error, please immediately alert the sender
by reply e-mail and then delete this message
and any attachments

Result query:

SpanNearQuery spanNear = new SpanNearQuery(new SpanQuery[] {
new SpanTermQuery(new Term(BODY, "intended")),
new SpanTermQuery(new Term(BODY, "message"))},
4,
false);
SpanNearQuery spanNear2 = new SpanNearQuery(new SpanQuery[] {spanNear, new SpanTermQuery(new Term(BODY, "message"))}, 5, false);
SpanNearQuery spanNear3 = new SpanNearQuery(new SpanQuery[] {spanNear2, new SpanTermQuery(new Term(BODY, "addressed"))}, 3, false);

---
Migrated from [LUCENE-2861](https://issues.apache.org/jira/browse/LUCENE-2861) by Zenoviy Veres, 1 vote, updated Sep 05 2016
Environment:
```
Doesn't depend on enviroment
```

Linked issues:
- #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.