Package org.apache.lucene.search

Examples of org.apache.lucene.search.DocIdSetIterator.nextDoc()


    DocIdSetIterator ib = b.iterator();

    // test for next() equivalence
    for(;;) {
      int da = ia.nextDoc();
      int db = ib.nextDoc();
      assertEquals(da, db);
      assertEquals(ia.docID(), ib.docID());
      if (da==DocIdSetIterator.NO_MORE_DOCS) break;
    }
View Full Code Here


      int doc = -1;
      for (;;) {
        int da,db;
        if (rand.nextBoolean()) {
          da = ia.nextDoc();
          db = ib.nextDoc();
        } else {
          int target = doc + rand.nextInt(10) + 1// keep in mind future edge cases like probing (increase if necessary)
          da = ia.advance(target);
          db = ib.advance(target);
        }
View Full Code Here

        bitSet.fastSet(100);
        assertThat(bitSet.fastGet(100), equalTo(true));

        DocIdSetIterator iterator = bitSet.iterator();
        assertThat(iterator.nextDoc(), equalTo(100));
        assertThat(iterator.nextDoc(), equalTo(DocIdSetIterator.NO_MORE_DOCS));
    }

    @Test public void testCopy() throws IOException {
        int numberOfBits = 500;
View Full Code Here

        bitSet.fastSet(100);
        assertThat(bitSet.fastGet(100), equalTo(true));

        DocIdSetIterator iterator = bitSet.iterator();
        assertThat(iterator.nextDoc(), equalTo(100));
        assertThat(iterator.nextDoc(), equalTo(DocIdSetIterator.NO_MORE_DOCS));
    }

    @Test public void testCopy() throws IOException {
        int numberOfBits = 500;
        OpenBitSet bitSet = new OpenBitSet(numberOfBits);
View Full Code Here

        DocIdSetIterator it = set.iterator();
        if (it == null) {
            return DocSet.EMPTY_DOC_SET;
        }
        int doc = it.nextDoc();
        if (doc == DocIdSetIterator.NO_MORE_DOCS) {
            return DocSet.EMPTY_DOC_SET;
        }

        // we have a LAB, check if can be used...
View Full Code Here

        } else if (set instanceof OpenBitDocSet) {
            return new SlicedOpenBitSet(allocation.getData(), allocation.getOffset(), ((OpenBitDocSet) set).set());
        } else {
            SlicedOpenBitSet slicedSet = new SlicedOpenBitSet(allocation.getData(), numOfWords, allocation.getOffset());
            slicedSet.fastSet(doc); // we already have an open iterator, so use it, and don't forget to set the initial one
            while ((doc = it.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
                slicedSet.fastSet(doc);
            }
            return slicedSet;
        }
    }
View Full Code Here

    DocIDMapperImpl mapper = new DocIDMapperImpl(even);
    UIDDocIdSet uidSet = new UIDDocIdSet(even, mapper);
    DocIdSetIterator docidIter = uidSet.iterator();
    IntArrayList intList = new IntArrayList();
    int docid;
    while((docid=docidIter.nextDoc())!=DocIdSetIterator.NO_MORE_DOCS){
      intList.add(docid);
    }
    assertTrue("wrong result from iter", Arrays.equals(ans, intList.toIntArray()));

    long[] newidArray = new long[count];
View Full Code Here

    intList = new IntArrayList();
    for (int i=0;i<newidArray.length;++i){
      docid = docidIter.advance(i*10);
      if (docid == DocIdSetIterator.NO_MORE_DOCS) break;
      intList.add(docid);
      docid = docidIter.nextDoc();
      if (docid == DocIdSetIterator.NO_MORE_DOCS) break;
      intList.add(docid);
    }

    int[] answer = new int[]{0,1,10,11,20,21,30,31,40,41,50,51,60,61,70,71,80,81,90,91};
View Full Code Here

            Item top = _heap[0];
            while (true) {
                DocIdSetIterator topIter = top.iter;
                int docid;
                if ((docid = topIter.nextDoc()) != DocIdSetIterator.NO_MORE_DOCS) {
                    top.doc = docid;
                    heapAdjust();
                } else {
                    heapRemoveRoot();
                    if (_size == 0) return (_curDoc = DocIdSetIterator.NO_MORE_DOCS);
View Full Code Here

        public final int nextDoc() throws IOException {

            if (lastReturn == DocIdSetIterator.NO_MORE_DOCS) return DocIdSetIterator.NO_MORE_DOCS;

            DocIdSetIterator dcit = iterators[0];
            int target = dcit.nextDoc();
            int size = iterators.length;
            int skip = 0;
            int i = 1;
            while (i < size) {
                if (i != skip) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.