Package org.apache.lucene.search

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


    DocIdSet docIdSet0_9 = arrayToDocIdSet( testDataFrom0to9 );
    DocIdSetIterator docIdSetIterator = docIdSet0_9.iterator();
    assertTrue( docIdSetIterator.nextDoc() != DocIdSetIterator.NO_MORE_DOCS );
    assertEquals( 0, docIdSetIterator.docID() );
    assertEquals( 9, docIdSetIterator.advance( 9 ) );
    assertEquals( DocIdSetIterator.NO_MORE_DOCS, docIdSetIterator.advance( 10 ) );
  }

  @Test
  public void testAndDocIdSets() {
    List<DocIdSet> filters = new ArrayList<DocIdSet>( 2 );
View Full Code Here


      for (int i=0;i<disis.length;i++) {
        // TODO: should we sort this 2nd dimension of
        // docsEnums from most frequent to least?
        DocIdSetIterator disi = disis[i];
        if (disi != null && disi.docID() < docID) {
          disi.advance(docID);
        }
        if (disi == null || disi.docID() > docID) {
          if (failedCollector != null) {
            // More than one dim fails on this document, so
            // it's neither a hit nor a near-miss; move to
View Full Code Here

          final int target = doc + 1 + random().nextInt(random().nextBoolean() ? 64 : Math.max(numBits / 8, 1));
          doc = ds1.nextSetBit(target);
          if (doc == -1) {
            doc = DocIdSetIterator.NO_MORE_DOCS;
          }
          assertEquals(doc, it2.advance(target));
          assertEquals(doc, it2.docID());
        }
      }
    }
View Full Code Here

  void doIterate1(BitSet a, FixedBitSet b) throws IOException {
    int aa=-1,bb=-1;
    DocIdSetIterator iterator = b.iterator();
    do {
      aa = a.nextSetBit(aa+1);
      bb = (bb < b.length() && random().nextBoolean()) ? iterator.nextDoc() : iterator.advance(bb + 1);
      assertEquals(aa == -1 ? DocIdSetIterator.NO_MORE_DOCS : aa, bb);
    } while (aa>=0);
  }

  void doIterate2(BitSet a, FixedBitSet b) throws IOException {
View Full Code Here

  void doIterate2(BitSet a, FixedBitSet b) throws IOException {
    int aa=-1,bb=-1;
    DocIdSetIterator iterator = b.iterator();
    do {
      aa = a.nextSetBit(aa+1);
      bb = random().nextBoolean() ? iterator.nextDoc() : iterator.advance(bb + 1);
      assertEquals(aa == -1 ? DocIdSetIterator.NO_MORE_DOCS : aa, bb);
    } while (aa>=0);
  }

  void doRandomSets(int maxSize, int iter, int mode) throws IOException {
View Full Code Here

    i = 0;
    votes = 0; //could be smarter but would make the code even more complex for a minor optimization out of cycle.
    // enter main loop:
    while ( true ) {
      final DocIdSetIterator iterator = iterators[i];
      final int position = iterator.advance( targetPosition );
      if ( position==DocIdSetIterator.NO_MORE_DOCS )
        return result; //exit condition
      if ( position == targetPosition ) {
        if ( ++votes == iteratorSize ) {
          result.fastSet( position );
View Full Code Here

                collector.collect(doc);

                target = filterDocIdIterator.nextDoc();
              } else {
                // skip to the next possible docid
                target = filterDocIdIterator.advance(validator._nextTarget);
              }
            } else // doc > target
            {
              if (doc == DocIdSetIterator.NO_MORE_DOCS) break;
              target = filterDocIdIterator.advance(doc);
View Full Code Here

                target = filterDocIdIterator.advance(validator._nextTarget);
              }
            } else // doc > target
            {
              if (doc == DocIdSetIterator.NO_MORE_DOCS) break;
              target = filterDocIdIterator.advance(doc);
            }
          }
        } else {
          // MapReduce wrapper is not null
          while (target < DocIdSetIterator.NO_MORE_DOCS) {
View Full Code Here

                collector.collect(doc);

                target = filterDocIdIterator.nextDoc();
              } else {
                // skip to the next possible docid
                target = filterDocIdIterator.advance(validator._nextTarget);
              }
            } else // doc > target
            {
              if (doc == DocIdSetIterator.NO_MORE_DOCS) break;
              target = filterDocIdIterator.advance(doc);
View Full Code Here

                target = filterDocIdIterator.advance(validator._nextTarget);
              }
            } else // doc > target
            {
              if (doc == DocIdSetIterator.NO_MORE_DOCS) break;
              target = filterDocIdIterator.advance(doc);
            }
          }
          mapReduceWrapper.finalizeSegment(_subReaders[i], validator.getCountCollectors());
        }
      }
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.