lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] [Created] (LUCENE-4300) BooleanQuery inconsistently applies coord() if it rewrites itself
Date Thu, 09 Aug 2012 23:52:19 GMT
Robert Muir created LUCENE-4300:

             Summary: BooleanQuery inconsistently applies coord() if it rewrites itself
                 Key: LUCENE-4300
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Robert Muir

Tripped by the new random sim from LUCENE-4297:

The basics are this:
* BooleanQuery has the following rewrite():
  public Query rewrite(IndexReader reader) throws IOException {
    if (minNrShouldMatch == 0 && clauses.size() == 1) {                    // optimize
1-clause queries

* you have a coord() impl that doesnt return 1.0 if overlap == maxOverlap, particularly:
return overlap / ((float)maxOverlap + 1);

* TestBooleanMinShouldMatch.testRandomQueries generates random boolean queries (Q1), then
compares the scores of the random query to the same query but with minNrShouldmatch applied
to its should clauses (Q2)

* in the case of a single term BQ, the rewrite applies to Q1, making it a term query, but
not to Q2. so the coord() only gets called for Q2, not Q1. and with this crazy coord it means
the scores are different.

I think the rewrite is wrong, we should also rewrite single-query BQs where minNrShouldMatch
= 1 and there is a single optional clause.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message