lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trejkaz <trej...@trypticon.org>
Subject Re: What on earth is FilteredQuery.explain doing?
Date Wed, 15 Jul 2015 01:32:14 GMT
On Wed, Jul 15, 2015 at 4:50 AM, Terry Smith <shebiki@gmail.com> wrote:
>
> This looks like a bug that has already been fixed on branch_5x as part of
> LUCENE-6601 <https://issues.apache.org/jira/browse/LUCENE-6601>. The bug is
> in org.apache.search.Filter.createWeight:
[snip]
> Here you can see it calls Explanation.match for the last return instead
> of Explanation.noMatch.
>
> I imagine this will make it to the next 5.x point release.

The patch here certainly fixes this test, so I thought it was the fix,
but now the opposite test fails:

    @Test
    public void testSearch_FilterExcludesDoc() throws Exception
    {
        TopDocs topDocs = searcher.search(query, filter, 10);
        int matchedDoc = topDocs.scoreDocs[0].doc;
        int doc = matchedDoc == 0 ? 1 : 0; // <- gets the non-matching doc

        // double-check anyway, never know, could match both.
        for (ScoreDoc scoreDoc : topDocs.scoreDocs)
        {
            assertNotEquals(scoreDoc.doc, doc);
        }

        Explanation explanation = searcher.explain(new
FilteredQuery(query, filter), doc);
        assertThat(explanation.isMatch(), is(false));
    }

This now fails because isMatch() returns true for an item which
*didn't* match the search. Should I go and comment on that ticket or
just open a new one?

TX

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message