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

Improve TermInSetQuery.toString

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.3, 8.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Today a TermInSetQuery on field F and terms A, B, C returns this from toString:

        F:A F:B F:C
      

      But this gets misleading when you embed it in a BooleanQuery as a negated clause, which then renders like this:

        -F:A F:B F:C
      

      Making it look like only the first clause is negated when in fact they all are.

      So ... I'd like to instead change it to:

      F:(A B C)
      

      I know Query.toString is simply best-effort, is not guaranteed to make something you can then parse in any query parser back to itself, etc., but I think we should still try to make a string that is not misleading when humans stare at it?

        Attachments

        1. LUCENE-8094.patch
          2 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mikemccand Michael McCandless
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: