SpanNearQuery inconsistency: should it accept less than 2 clauses or not? [LUCENE-2577]
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 88
Description
NearSpansOrdered's constructor will throw an IllegalArgumentException
if less than 2 clauses are given, while NearSpansOrdered won't.
On the other hand, SpanNearQuery accepts less than 2 clauses and has explicit optimization for 0-caluse and 1-clause queries in getSpans() method.
So, should SpanNearQuery accept less than 2 clauses or not?
---
Migrated from [LUCENE-2577](https://issues.apache.org/jira/browse/LUCENE-2577) by Santiago M. Mola
Contributor guide
Research direction
Start by comparing NearSpansOrdered's constructor behavior with SpanNearQuery's handling of fewer than two clauses in getSpans(). Review the existing zero-clause and one-clause optimizations and determine the intended consistent contract. Done means the accepted clause counts and resulting behavior are explicitly decided and consistently reflected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- search
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100