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

Add a root failure cause to Explanation

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • New, Patch Available

    Description

      If you need to analyze the root cause of a query's failure to match some document, you can use the Weight.explain() API. If you want to do some gross analysis of a whole batch of queries, say scraped from a log, that once matched, but no longer do, perhaps after some refactoring or other large-scale change, the Explanation isn't very good for that. You can try parsing its textual output, which is pretty regular, but instead I found it convenient to add some boolean structure to Explanation, and use that to find failing leaves on the Explanation tree, and report only those.

      This patch adds a "condition" to each Explanation, which can be REQUIRED, OPTIONAL, PROHIBITED, or NONE. The conditions correspond in obvious ways to the Boolean Occur, except for NONE, which is used to indicate a node which can't be further decomposed. It adds new Explanation construction methods for creating Explanations with conditions (defaulting to NONE with the existing methods).

      Finally Explanation.getFailureCauses() returns a list of Strings that are the one-line explanations of the failing queries that, if some of them had succeeded, would have made the original overall query match.

      Attachments

        1. LUCENE_8019.patch
          15 kB
          Michael Sokolov
        2. LUCENE-8019.patch
          12 kB
          Michael Sokolov

        Activity

          People

            Unassigned Unassigned
            sokolov Michael Sokolov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: