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

Add an optional reason to the MatchNoDocsQuery

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2, 7.0
    • Component/s: core/search
    • Labels:
    • Lucene Fields:
      New, Patch Available

      Description

      It's sometimes difficult to debug a query that results in a MatchNoDocsQuery. The MatchNoDocsQuery is always rewritten in an empty boolean query.
      This patch adds an optional reason and implements a weight in order to keep track of the reason why the query did not match any document. The reason is printed on toString and when an explanation for noMatch is asked.
      For instance the query:
      new MatchNoDocsQuery("Field not found").toString()
      => 'MatchNoDocsQuery["field 'title' not found"]'

        Attachments

        1. LUCENE-7276.patch
          24 kB
          Michael McCandless
        2. LUCENE-7276.patch
          13 kB
          Michael McCandless
        3. LUCENE-7276.patch
          26 kB
          Michael McCandless
        4. LUCENE-7276.patch
          8 kB
          Michael McCandless
        5. LUCENE-7276.patch
          8 kB
          Michael McCandless
        6. LUCENE-7276.patch
          6 kB
          Jim Ferenczi

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jim.ferenczi Jim Ferenczi
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: