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

Decouple Filter from BitSet

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.1
    • 2.9
    • core/search
    • None

    Description

      package org.apache.lucene.search;
      
      public abstract class Filter implements java.io.Serializable 
      {
        public abstract AbstractBitSet bits(IndexReader reader) throws IOException;
      }
      
      public interface AbstractBitSet 
      {
        public boolean get(int index);
      }
      
      

      It would be useful if the method =Filter.bits()= returned an abstract interface, instead of =java.util.BitSet=.

      Use case: there is a very large index, and, depending on the user's privileges, only a small portion of the index is actually visible.
      Sparsely populated =java.util.BitSet=s are not efficient and waste lots of memory. It would be desirable to have an alternative BitSet implementation with smaller memory footprint.

      Though it is possibly to derive classes from =java.util.BitSet=, it was obviously not designed for that purpose.
      That's why I propose to use an interface instead. The default implementation could still delegate to =java.util.BitSet=.

      Attachments

        1. bench-diff.txt
          8 kB
          Doron Cohen
        2. bench-diff.txt
          7 kB
          Otis Gospodnetic
        3. CHANGES.txt.patch
          0.7 kB
          Paul Elschot
        4. ContribQueries20080111.patch
          2 kB
          Paul Elschot
        5. lucene-584.patch
          34 kB
          Michael Busch
        6. lucene-584-take2.patch
          52 kB
          Michael Busch
        7. lucene-584-take3-part1.patch
          37 kB
          Michael Busch
        8. lucene-584-take3-part2.patch
          77 kB
          Michael Busch
        9. lucene-584-take4-part1.patch
          39 kB
          Michael Busch
        10. lucene-584-take4-part2.patch
          77 kB
          Michael Busch
        11. lucene-584-take5-part1.patch
          47 kB
          Michael Busch
        12. lucene-584-take5-part2.patch
          76 kB
          Michael Busch
        13. Matcher-20070905-2default.patch
          75 kB
          Paul Elschot
        14. Matcher-20070905-3core.patch
          18 kB
          Paul Elschot
        15. Matcher-20071122-1ground.patch
          32 kB
          Paul Elschot
        16. Some Matchers.zip
          9 kB
          Eks Dev
        17. Test20080111.patch
          6 kB
          Paul Elschot

        Issue Links

          Activity

            People

              markrmiller@gmail.com Mark Miller
              nightrider Peter Schäfer
              Votes:
              11 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: