@Test public void testOrDocIdIterator() { int[] docIds1 = new int[]{1, 4, 6, 10, 15, 17, 18, 20}; int[] docIds2 = new int[]{0, 1, 5, 8, 15, 18}; int[] docIds3 = new int[]{1, 2, 6, 13, 16, 19}; MutableRoaringBitmap bitmap1 = new MutableRoaringBitmap(); bitmap1.add(docIds1); MutableRoaringBitmap bitmap2 = new MutableRoaringBitmap(); bitmap2.add(docIds2); MutableRoaringBitmap bitmap3 = new MutableRoaringBitmap(); bitmap3.add(docIds3); OrDocIdIterator andDocIdIterator = new OrDocIdIterator( new BlockDocIdIterator[]{new RangelessBitmapDocIdIterator(bitmap1), new RangelessBitmapDocIdIterator( bitmap2), new RangelessBitmapDocIdIterator(bitmap3)}); assertEquals(andDocIdIterator.advance(1), 1); assertEquals(andDocIdIterator.next(), 2); assertEquals(andDocIdIterator.next(), 4); assertEquals(andDocIdIterator.advance(7), 8); assertEquals(andDocIdIterator.advance(13), 13); assertEquals(andDocIdIterator.next(), 15); assertEquals(andDocIdIterator.advance(18), 18); assertEquals(andDocIdIterator.next(), 19); assertEquals(andDocIdIterator.advance(21), Constants.EOF); }
public OrDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; int numDocIdIterators = docIdIterators.length; _nextDocIds = new int[numDocIdIterators]; Arrays.fill(_nextDocIds, -1); _numNotExhaustedIterators = numDocIdIterators; }
OrDocIdIterator implements BlockDocIdIterator { public OrDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; int numDocIdIterators = docIdIterators.length; _nextDocIds = new int[numDocIdIterators]; Arrays.fill(_nextDocIds, -1); _numNotExhaustedIterators = numDocIdIterators; } }
OrDocIdIterator implements BlockDocIdIterator { public OrDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; int numDocIdIterators = docIdIterators.length; _nextDocIds = new int[numDocIdIterators]; Arrays.fill(_nextDocIds, -1); _numNotExhaustedIterators = numDocIdIterators; } OrDocIdIterator(BlockDocIdIterator[] docIdIterators); }
OrDocIdIterator implements BlockDocIdIterator { public OrDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; int numDocIdIterators = docIdIterators.length; _nextDocIds = new int[numDocIdIterators]; Arrays.fill(_nextDocIds, -1); _numNotExhaustedIterators = numDocIdIterators; } OrDocIdIterator(BlockDocIdIterator[] docIdIterators); @Override int next(); @Override int advance(int targetDocId); }
OrDocIdIterator implements BlockDocIdIterator { public OrDocIdIterator(BlockDocIdIterator[] docIdIterators) { _docIdIterators = docIdIterators; int numDocIdIterators = docIdIterators.length; _nextDocIds = new int[numDocIdIterators]; Arrays.fill(_nextDocIds, -1); _numNotExhaustedIterators = numDocIdIterators; } OrDocIdIterator(BlockDocIdIterator[] docIdIterators); @Override int next(); @Override int advance(int targetDocId);  }