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

Make Filter.clone and Filter.setBoost throw an UnsupportedOperationException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • New

    Description

      The rewrite process uses a combination of calls to clone() and setBoost(boost) in order to rewrite queries. This is a bit weird for filters given that they were not originally designed to care about scoring.

      Using a filter directly as a query fails unit tests today since filters do not pass the QueryUtils checks: it is expected that cloning and changing the boost results in an instance which is unequal. However existing filters do not take into account the getBoost() parameter inherited from Query so this test fails.

      I think it would be less error-prone to throw an UnsupportedOperationException for clone() and setBoost() on filters and disable the check in QueryUtils for filters.

      In order to keep rewriting working, filters could rewrite to a CSQ around themselves so that clone() and setBoost() would be called on the CSQ.

      Attachments

        1. queryextendsfilter-20150307b.patch
          46 kB
          Paul Elschot
        2. queryextendsfilter-20150307.patch
          6 kB
          Paul Elschot
        3. LUCENE-6328.patch
          10 kB
          Adrien Grand

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: