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

Decouple DocIdSet from OpenBitSet and FixedBitSet

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.6.1
    • 5.0, 6.0
    • core/other
    • None
    • New

    Description

      Back from the times of Lucene 2.4 when DocIdSet was introduced, we somehow kept the stupid "filters can return a BitSet directly" in the code. So lots of Filters return just FixedBitSet, because this is the superclass (ideally interface) of FixedBitSet.

      We should decouple that and not implement that abstract interface directly by FixedBitSet. This leads to bugs e.g. in BlockJoin, because it used Filters in a wrong way, just because it was always returning Bitsets. But some filters actually don't do this.

      I propose to let FixedBitSet (only in trunk, because that a major backwards break) just have a method asDocIdSet(), that returns an anonymous instance of DocIdSet: bits() returns the FixedBitSet itsself, iterator() returns a new Iterator (like it always did) and the cost/cacheable methods return static values.

      Filters in trunk would need to be changed like that:

      FixedBitSet bits = ....
      ...
      return bits;
      

      gets:

      FixedBitSet bits = ....
      ...
      return bits.asDocIdSet();
      

      As this methods returns an anonymous DocIdSet, calling code can no longer rely or check if the implementation behind is a FixedBitSet.

      Attachments

        1. LUCENE-5441.patch
          75 kB
          Adrien Grand
        2. LUCENE-5441.patch
          235 kB
          Adrien Grand
        3. LUCENE-5441.patch
          58 kB
          Uwe Schindler
        4. LUCENE-5441.patch
          32 kB
          Uwe Schindler
        5. LUCENE-5441.patch
          25 kB
          Uwe Schindler

        Issue Links

          Activity

            People

              Unassigned Unassigned
              uschindler Uwe Schindler
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: