Details
-
New Feature
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
-
New
Description
QueryBuilder has historically built phrases according to the semantics of (Multi)PhraseQuery (which incorporates the concept of order, but allows for negative offsets in calculating slop/edit distance).
LUCENE-8531 corrected a bug that substituted SpanNearQuery (inOrder=true) implementation for graph phrase queries despite the fact thatĀ for slop > 0 the semantics of SpanNearQuery (inOrder=[true|false]) differ from the semantics of (Multi)PhraseQuery.
Inspired by (but not related to) LUCENE-8531, this issue considers the likelihood that there are some common use cases for which SpanNearQuery semantics may be preferable to the semantics of PhraseQuery. The distinction between the two is clearer for the inOrder=true case of SpanNearQuery, which disallows negative offsets in calculating slop/edit distance.
The logic for building SpanNearQuery is already present in QueryBuilder; perhaps QueryBuilder could expose that logic so that it can be leveraged in cases that explicitly desire SpanNearQuery (and associated semantics).