[ 
https://issues.apache.org/jira/browse/LUCENE-7398?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15405698#comment-15405698
 ] 

Paul Elschot commented on LUCENE-7398:
--------------------------------------

The patch of 22:53 hrs works as expected.

This additional test case fails on doc 0, "w1 w2 w3 w4 w5":
{code}
  @Test
  public void testNestedOrQuerySlop() throws IOException {
    SpanNearQuery snq = SpanNearQuery.newOrderedNearQuery(FIELD)
        .setSlop(1)
        .addClause(new SpanTermQuery(new Term(FIELD, "w1")))
        .addClause(new SpanOrQuery(
            new SpanTermQuery(new Term(FIELD, "w2")),
            SpanNearQuery.newOrderedNearQuery(FIELD)
                .addClause(new SpanTermQuery(new Term(FIELD, "w3")))
                .addClause(new SpanTermQuery(new Term(FIELD, "w4")))
                .build()
        ))
        .addClause(new SpanTermQuery(new Term(FIELD, "w5")))
        .build();

    Spans spans = snq.createWeight(searcher, false, 
1).getSpans(searcher.getIndexReader().leaves().get(0), 
SpanWeight.Postings.POSITIONS);
    assertEquals(0, spans.advance(0));
    assertEquals(Spans.NO_MORE_DOCS, spans.nextDoc());
  }
{code}
and it passes when using setSlop(2) instead of setSlop(1).

Perhaps we should also add the above test case with setSlop(2) and a comment 
that it actually should pass with setSlop(1).


> Nested Span Queries are buggy
> -----------------------------
>
>                 Key: LUCENE-7398
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7398
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/search
>    Affects Versions: 5.5, 6.x
>            Reporter: Christoph Goller
>            Assignee: Alan Woodward
>            Priority: Critical
>         Attachments: LUCENE-7398.patch, LUCENE-7398.patch, 
> TestSpanCollection.java
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to