Lucene - Core
  1. Lucene - Core
  2. LUCENE-5101

make it easier to plugin different bitset implementations to CachingWrapperFilter

    Details

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

      Description

      Currently this is possible, but its not so friendly:

        protected DocIdSet docIdSetToCache(DocIdSet docIdSet, AtomicReader reader) throws IOException {
          if (docIdSet == null) {
            // this is better than returning null, as the nonnull result can be cached
            return EMPTY_DOCIDSET;
          } else if (docIdSet.isCacheable()) {
            return docIdSet;
          } else {
            final DocIdSetIterator it = docIdSet.iterator();
            // null is allowed to be returned by iterator(),
            // in this case we wrap with the sentinel set,
            // which is cacheable.
            if (it == null) {
              return EMPTY_DOCIDSET;
            } else {
      /* INTERESTING PART */
              final FixedBitSet bits = new FixedBitSet(reader.maxDoc());
              bits.or(it);
              return bits;
      /* END INTERESTING PART */
            }
          }
        }
      

      Is there any value to having all this other logic in the protected API? It seems like something thats not useful for a subclass... Maybe this stuff can become final, and "INTERESTING PART" calls a simpler method, something like:

      protected DocIdSet cacheImpl(DocIdSetIterator iterator, AtomicReader reader) {
        final FixedBitSet bits = new FixedBitSet(reader.maxDoc());
        bits.or(iterator);
        return bits;
      }
      
      1. LUCENE-5101.patch
        3 kB
        Robert Muir
      2. DocIdSetBenchmark.java
        8 kB
        Adrien Grand
      3. LUCENE-5101.patch
        7 kB
        Robert Muir
      4. LUCENE-5101.patch
        24 kB
        Adrien Grand
      5. LUCENE-5101.patch
        24 kB
        Adrien Grand

        Activity

        Robert Muir created issue -
        Robert Muir made changes -
        Field Original Value New Value
        Attachment LUCENE-5101.patch [ 12592174 ]
        Adrien Grand made changes -
        Attachment DocIdSetBenchmark.java [ 12592573 ]
        Robert Muir made changes -
        Attachment LUCENE-5101.patch [ 12597238 ]
        Adrien Grand made changes -
        Attachment LUCENE-5101.patch [ 12601643 ]
        Adrien Grand made changes -
        Attachment LUCENE-5101.patch [ 12601643 ]
        Adrien Grand made changes -
        Attachment LUCENE-5101.patch [ 12601653 ]
        Adrien Grand made changes -
        Attachment LUCENE-5101.patch [ 12601673 ]
        Adrien Grand made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 5.0 [ 12321663 ]
        Fix Version/s 4.5 [ 12324742 ]
        Resolution Fixed [ 1 ]
        Adrien Grand made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Robert Muir
          • Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development