lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] Updated: (LUCENE-2756) MultiSearcher.rewrite() incorrectly rewrites queries
Date Fri, 12 Nov 2010 13:05:14 GMT


Robert Muir updated LUCENE-2756:

    Attachment: LUCENE-2756_testcase.patch

attached is a simple test, it adds a single document "foo bar" to one index,
and another document "foo baz" to another.

if you do the query "+foo -ba*", the multisearcher rewrites this to:
(+field:foo -field:baz) (+field:foo -field:bar)

This causes both documents to match the query, when really neither should.
instead the query should be (+field:foo -field:baz -field:bar)

if you run the test with -Dtests.verbose=true you can see the rewritten form.

the reason this only appeared with a certain document count for the issue on the
user's list is because they were using CONSTANT_SCORE_AUTO and with that
document count it was deciding to use a constant-score boolean rewrite method.

> MultiSearcher.rewrite() incorrectly rewrites queries
> ----------------------------------------------------
>                 Key: LUCENE-2756
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Robert Muir
>         Attachments: LUCENE-2756_testcase.patch
> This was reported on the userlist, in the context of range queries.
> Its also easy to make our existing tests fail with my patch on LUCENE-2751:
> {noformat}
> ant test-core -Dtestcase=TestBoolean2 -Dtestmethod=testRandomQueries -Dtests.seed=7679849347282878725:-903778383189134045
> {noformat}
> The fundamental problem is that MultiSearcher first rewrites against individual subs,

> then uses Query.combine() which simply OR's these sub-clauses.
> This is incorrect for expanded MUST_NOT queries (e.g. from wildcard), as it violates
demorgan's law.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message