Package org.apache.lucene.search

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


      final DocIdSetIterator iterator = iterators[i];
      if ( ! iterator.next() ) {
        //current iterator has no values, so skip all
        return EmptyDocIdBitSet.instance;
      }
      final int position = iterator.doc();
      if ( targetPosition==position ) {
        votes++; //stopped as same position of others
      }
      else {
        targetPosition = max( targetPosition, position );
View Full Code Here


    while ( true ) {
      final DocIdSetIterator iterator = iterators[i];
      final boolean validPosition = iterator.skipTo( targetPosition );
      if ( ! validPosition )
        return result; //exit condition
      final int position = iterator.doc();
      if ( position == targetPosition ) {
        if ( ++votes == iteratorSize ) {
          result.fastSet( position );
          votes = 0;
          targetPosition++;
View Full Code Here

    DocIdSetIterator idSetIterator = docIdSet.iterator();
    for ( int setBit : expectedIds ) {
      if ( ! idSetIterator.next() ) {
        return false;
      }
      if ( idSetIterator.doc() != setBit ) {
        return false;
      }
    }
    if ( idSetIterator.next() ){
      return false;
View Full Code Here

  // auto-testing of test utility methods for conversion in DocIdSetIterator
  public void testIteratorMatchesTestArray() throws IOException {
    DocIdSet docIdSet0_9 = arrayToDocIdSet(testDataFrom0to9);
    DocIdSetIterator docIdSetIterator = docIdSet0_9.iterator();
    assertTrue( docIdSetIterator.next() );
    assertEquals( 0, docIdSetIterator.doc() );
    assertTrue( docIdSetIterator.skipTo(9) );
    assertFalse( docIdSetIterator.skipTo(10) );
  }
 
  public void testAndDocIdSets() {
View Full Code Here

  private static int iterateOnResults(DocIdSet docIdBitSet) throws IOException {
    DocIdSetIterator iterator = docIdBitSet.iterator();
    int i = 0;
    while ( iterator.next() ) {
      i += iterator.doc();
    }
    return i;
  }

  private static final BitSet applyANDOnBitSets(final List<BitSet> filtersData) {
View Full Code Here

          return false;
        }
        else if ( nextA==false) {
          return true;
        }
        else if ( iterA.doc() != iterB.doc() ) {
          return false;
        }
      } while ( nextA && nextB );
    }
    catch (IOException ioe) {
View Full Code Here

    DocIdSetIterator idSetIterator = docIdSet.iterator();
    for ( int setBit : expectedIds ) {
      if ( ! idSetIterator.next() ) {
        return false;
      }
      if ( idSetIterator.doc() != setBit ) {
        return false;
      }
    }
    if ( idSetIterator.next() ){
      return false;
View Full Code Here

      final DocIdSetIterator iterator = iterators[i];
      if ( ! iterator.next() ) {
        //current iterator has no values, so skip all
        return EmptyDocIdBitSet.instance;
      }
      final int position = iterator.doc();
      if ( targetPosition==position ) {
        votes++; //stopped as same position of others
      }
      else {
        targetPosition = max( targetPosition, position );
View Full Code Here

    while ( true ) {
      final DocIdSetIterator iterator = iterators[i];
      final boolean validPosition = iterator.skipTo( targetPosition );
      if ( ! validPosition )
        return result; //exit condition
      final int position = iterator.doc();
      if ( position == targetPosition ) {
        if ( ++votes == iteratorSize ) {
          result.fastSet( position );
          votes = 0;
          targetPosition++;
View Full Code Here

  // auto-testing of test utility methods for conversion in DocIdSetIterator
  public void testIteratorMatchesTestArray() throws IOException {
    DocIdSet docIdSet0_9 = arrayToDocIdSet(testDataFrom0to9);
    DocIdSetIterator docIdSetIterator = docIdSet0_9.iterator();
    assertTrue( docIdSetIterator.next() );
    assertEquals( 0, docIdSetIterator.doc() );
    assertTrue( docIdSetIterator.skipTo(9) );
    assertFalse( docIdSetIterator.skipTo(10) );
  }
 
  public void testAndDocIdSets() {
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.