[
https://issues.apache.org/jira/browse/LUCENE-7848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053806#comment-16053806
]
Dawid Weiss commented on LUCENE-7848:
-------------------------------------
Couldn't resist not to look. The index is fine. The query seems to be off
though -- here:
{code}
spanNear([field:SPECIAL,
field:PROJECTS,
field:-,
spanOr([spanNear([SpanGap(:1),
field:xxx,SPECIAL], 0, true),
spanNear([SpanGap(:1),
field:xxx,
field:SPECIAL], 0, true)]),
field:PROJECTS,
field:-,
SpanGap(:1),
field:yyy], 0, true)
{code}
The problem is in those gaps inside {{spanOr}} -- the position increments get
screwed up somehow. I created the above query manually and this one works just
fine:
{code}
Query q = SpanNearQuery.newOrderedNearQuery(field)
.addClause(new SpanTermQuery(new Term(field, "SPECIAL")))
.addClause(new SpanTermQuery(new Term(field, "PROJECTS")))
.addClause(new SpanTermQuery(new Term(field, "-")))
.addGap(1)
.addClause(new SpanOrQuery(
SpanNearQuery.newOrderedNearQuery(field)
.addClause(new SpanTermQuery(new Term(field, "xxx,SPECIAL")))
.addGap(1)
.build(),
SpanNearQuery.newOrderedNearQuery(field)
.addClause(new SpanTermQuery(new Term(field, "xxx")))
.addClause(new SpanTermQuery(new Term(field, "SPECIAL")))
.build()
))
.addClause(new SpanTermQuery(new Term(field, "PROJECTS")))
.addClause(new SpanTermQuery(new Term(field, "-")))
.addGap(1)
.addClause(new SpanTermQuery(new Term(field, "yyy")))
.build();
{code}
Note the leading gap is pulled outside, that's pretty much all the difference
(another {{addGap(1)}} inside the "xxx,SPECIAL" condition is irrelevant here).
Could be a bug somewhere in span queries.
> QueryBuilder.analyzeGraphPhrase does not handle gaps correctly
> --------------------------------------------------------------
>
> Key: LUCENE-7848
> URL: https://issues.apache.org/jira/browse/LUCENE-7848
> Project: Lucene - Core
> Issue Type: Bug
> Affects Versions: 6.5, 6.6
> Reporter: Jim Ferenczi
> Attachments: capture-3.png, LUCENE-7848.patch, LUCENE-7848.patch
>
>
> Position increments greater than 1 are ignored when the query builder creates
> a graph phrase query.
> Instead it should use SpanNearQuery.addGap for pos incr > 1.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]