Package org.apache.lucene.search

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


          doc = ds1.nextSetBit(doc + 1);
          if (doc == -1) {
            doc = DocIdSetIterator.NO_MORE_DOCS;
          }
          assertEquals(doc, it2.nextDoc());
          assertEquals(doc, it2.docID());
        } else {
          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;
View Full Code Here


          doc = ds1.nextSetBit(target);
          if (doc == -1) {
            doc = DocIdSetIterator.NO_MORE_DOCS;
          }
          assertEquals(doc, it2.advance(target));
          assertEquals(doc, it2.docID());
        }
      }
    }

    // bits()
View Full Code Here

      assertEquals("invalid maxDoc: " + doc, maxDoc, doc);
     
      DocIdSet docIDs = all.getDocIDs();
      assertTrue("should be cacheable", docIDs.isCacheable());
      DocIdSetIterator docIDsIter = docIDs.iterator();
      assertEquals("nextDoc() hasn't been called yet", -1, docIDsIter.docID());
      assertEquals(0, docIDsIter.nextDoc());
      assertEquals(1, docIDsIter.advance(1));
      // if advance is smaller than current doc, advance to cur+1.
      assertEquals(2, docIDsIter.advance(0));
    } finally {
View Full Code Here

            return DEFAULT_SCORE;
          }

          @Override
          public int getDocID() {
            return iter.docID();
          }
        };
      } catch (IOException e) {
        // cannot happen
        throw new RuntimeException(e);
View Full Code Here

          @Override
          public float getScore() { return DEFAULT_SCORE; }

          @Override
          public int getDocID() { return docIterator.docID(); }
        };
      }

      @Override
      public int size() {
View Full Code Here

            return DEFAULT_SCORE;
          }

          @Override
          public int getDocID() {
            return iter.docID();
          }
        };
      } catch (IOException e) {
        // cannot happen
        throw new RuntimeException(e);
View Full Code Here

      assertEquals("invalid maxDoc: " + doc, maxDoc, doc);
     
      DocIdSet docIDs = all.getDocIDs();
      assertTrue("should be cacheable", docIDs.isCacheable());
      DocIdSetIterator docIDsIter = docIDs.iterator();
      assertEquals("nextDoc() hasn't been called yet", -1, docIDsIter.docID());
      assertEquals(0, docIDsIter.nextDoc());
      assertEquals(1, docIDsIter.advance(1));
      // if advance is smaller than current doc, advance to cur+1.
      assertEquals(2, docIDsIter.advance(0));
    } finally {
View Full Code Here

  @Test
  public void testIteratorMatchesTestArray() throws IOException {
    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
View Full Code Here

        nextA = iterA.nextDoc();
        nextB = iterB.nextDoc();
        if ( nextA != nextB ) {
          return false;
        }
        assertEquals( iterA.docID(), iterB.docID() );
      } while ( nextA != DocIdSetIterator.NO_MORE_DOCS );
    }
    catch (IOException ioe) {
      fail( "these DocIdSetIterator instances should not throw any exceptions" );
    }
View Full Code Here

      Collector failedCollector = null;
      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
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.