Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-10618

Implement BooleanQuery rewrite rules based for minimumShouldMatch

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 9.3
    • None
    • None
    • New

    Description

      While looking into a test failure I noticed that we sometimes create weights for boolean queries with no SHOULD clauses and a non-zero minimumNumberShouldMatch.

      We could rewrite BooleanQuery to MatchNoDocsQuery when the number of SHOULD clauses is less than minimumNumberShouldMatch, and make SHOULD clauses required when the number of SHOULD clauses is equal to minimumNumberShouldMatch.

      This feels a bit like a degenerate case (why would the use create such a query in the first place?) but this case can also happen to non-degenerate queries if some SHOULD clauses rewrite to a MatchNoDocsQuery and get removed through rewrite.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jpountz Adrien Grand
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h