@Test public void testAndDocIdIterator() { int[] docIds1 = new int[]{0, 1, 2, 3, 5, 7, 10, 12, 13, 15, 16, 18, 20}; int[] docIds2 = new int[]{1, 2, 4, 5, 6, 7, 9, 11, 12, 13, 15, 16, 17, 19, 20}; int[] docIds3 = new int[]{0, 2, 3, 4, 7, 8, 10, 11, 13, 15, 16, 19, 20}; MutableRoaringBitmap bitmap1 = new MutableRoaringBitmap(); bitmap1.add(docIds1); MutableRoaringBitmap bitmap2 = new MutableRoaringBitmap(); bitmap2.add(docIds2); MutableRoaringBitmap bitmap3 = new MutableRoaringBitmap(); bitmap3.add(docIds3); AndDocIdIterator andDocIdIterator = new AndDocIdIterator( new BlockDocIdIterator[]{new RangelessBitmapDocIdIterator(bitmap1), new RangelessBitmapDocIdIterator( bitmap2), new RangelessBitmapDocIdIterator(bitmap3)}); assertEquals(andDocIdIterator.next(), 2); assertEquals(andDocIdIterator.next(), 7); assertEquals(andDocIdIterator.advance(10), 13); assertEquals(andDocIdIterator.advance(16), 16); assertEquals(andDocIdIterator.next(), 20); assertEquals(andDocIdIterator.next(), Constants.EOF); }
public AndDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; }
AndDocIdIterator implements BlockDocIdIterator { public AndDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; } }
AndDocIdIterator implements BlockDocIdIterator { public AndDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; } AndDocIdIterator(BlockDocIdIterator[] docIdIterators); }
AndDocIdIterator implements BlockDocIdIterator { public AndDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; } AndDocIdIterator(BlockDocIdIterator[] docIdIterators); @Override int next(); @Override int advance(int targetDocId); }
AndDocIdIterator implements BlockDocIdIterator { public AndDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; } AndDocIdIterator(BlockDocIdIterator[] docIdIterators); @Override int next(); @Override int advance(int targetDocId); final BlockDocIdIterator[] _docIdIterators; }