@Test public void testFullyEmptyDocIdSet() throws IOException { int len = 10; DocIdSet docIdSet = BitSetDocumentVisibilityFilterCacheStrategy.getFullyEmptyDocIdSet(len); Bits bits = docIdSet.bits(); assertEquals(len, bits.length()); for (int i = 0; i < len; i++) { assertFalse(bits.get(i)); } assertTrue(docIdSet.isCacheable()); { DocIdSetIterator iterator = docIdSet.iterator(); assertEquals(-1, iterator.docID()); assertEquals(DocIdSetIterator.NO_MORE_DOCS, iterator.nextDoc()); assertEquals(DocIdSetIterator.NO_MORE_DOCS, iterator.docID()); } { DocIdSetIterator iterator = docIdSet.iterator(); assertEquals(-1, iterator.docID()); assertEquals(DocIdSetIterator.NO_MORE_DOCS, iterator.advance(0)); assertEquals(DocIdSetIterator.NO_MORE_DOCS, iterator.docID()); } }
public static DocIdSet getFullyEmptyDocIdSet(int maxDoc) { Bits bits = getFullyEmptyBits(maxDoc); return new DocIdSet() { @Override public DocIdSetIterator iterator() throws IOException { return getFullyEmptyDocIdSetIterator(maxDoc); } @Override public Bits bits() throws IOException { return bits; } @Override public boolean isCacheable() { return true; } }; }
BitSetDocumentVisibilityFilterCacheStrategy extends DocumentVisibilityFilterCacheStrategy { public static DocIdSet getFullyEmptyDocIdSet(int maxDoc) { Bits bits = getFullyEmptyBits(maxDoc); return new DocIdSet() { @Override public DocIdSetIterator iterator() throws IOException { return getFullyEmptyDocIdSetIterator(maxDoc); } @Override public Bits bits() throws IOException { return bits; } @Override public boolean isCacheable() { return true; } }; } }
BitSetDocumentVisibilityFilterCacheStrategy extends DocumentVisibilityFilterCacheStrategy { public static DocIdSet getFullyEmptyDocIdSet(int maxDoc) { Bits bits = getFullyEmptyBits(maxDoc); return new DocIdSet() { @Override public DocIdSetIterator iterator() throws IOException { return getFullyEmptyDocIdSetIterator(maxDoc); } @Override public Bits bits() throws IOException { return bits; } @Override public boolean isCacheable() { return true; } }; } BitSetDocumentVisibilityFilterCacheStrategy(); }
BitSetDocumentVisibilityFilterCacheStrategy extends DocumentVisibilityFilterCacheStrategy { public static DocIdSet getFullyEmptyDocIdSet(int maxDoc) { Bits bits = getFullyEmptyBits(maxDoc); return new DocIdSet() { @Override public DocIdSetIterator iterator() throws IOException { return getFullyEmptyDocIdSetIterator(maxDoc); } @Override public Bits bits() throws IOException { return bits; } @Override public boolean isCacheable() { return true; } }; } BitSetDocumentVisibilityFilterCacheStrategy(); @Override DocIdSet getDocIdSet(String fieldName, BytesRef term, AtomicReader reader); @Override Builder createBuilder(String fieldName, BytesRef term, final AtomicReader reader); static DocIdSet getFullyEmptyDocIdSet(int maxDoc); static DocIdSetIterator getFullyEmptyDocIdSetIterator(int maxDoc); static Bits getFullyEmptyBits(int maxDoc); static DocIdSet getFullySetDocIdSet(int maxDoc); static DocIdSetIterator getFullySetDocIdSetIterator(int maxDoc); static Bits getFullySetBits(int maxDoc); static boolean isFullyEmpty(OpenBitSet bitSet, long cardinality); static boolean isFullySet(int maxDoc, OpenBitSet bitSet, long cardinality); static SegmentReader getSegmentReader(IndexReader indexReader); @Override String toString(); }
BitSetDocumentVisibilityFilterCacheStrategy extends DocumentVisibilityFilterCacheStrategy { public static DocIdSet getFullyEmptyDocIdSet(int maxDoc) { Bits bits = getFullyEmptyBits(maxDoc); return new DocIdSet() { @Override public DocIdSetIterator iterator() throws IOException { return getFullyEmptyDocIdSetIterator(maxDoc); } @Override public Bits bits() throws IOException { return bits; } @Override public boolean isCacheable() { return true; } }; } BitSetDocumentVisibilityFilterCacheStrategy(); @Override DocIdSet getDocIdSet(String fieldName, BytesRef term, AtomicReader reader); @Override Builder createBuilder(String fieldName, BytesRef term, final AtomicReader reader); static DocIdSet getFullyEmptyDocIdSet(int maxDoc); static DocIdSetIterator getFullyEmptyDocIdSetIterator(int maxDoc); static Bits getFullyEmptyBits(int maxDoc); static DocIdSet getFullySetDocIdSet(int maxDoc); static DocIdSetIterator getFullySetDocIdSetIterator(int maxDoc); static Bits getFullySetBits(int maxDoc); static boolean isFullyEmpty(OpenBitSet bitSet, long cardinality); static boolean isFullySet(int maxDoc, OpenBitSet bitSet, long cardinality); static SegmentReader getSegmentReader(IndexReader indexReader); @Override String toString(); static final DocumentVisibilityFilterCacheStrategy INSTANCE; }