Package org.apache.lucene.search

Examples of org.apache.lucene.search.DocIdSetIterator


              // cost somehow, before pulling the iterator;
              // we should use that here to set the order to
              // check the filters:

            } else {
              DocIdSetIterator disi = dis.iterator();
              if (disi == null) {
                nullCount++;
                continue;
              }
              dims[dim].disi = disi;
            }
          } else {
            DocIdSetIterator disi = ((Weight) drillDowns[dim]).scorer(context, true, false, null);
            if (disi == null) {
              nullCount++;
              continue;
            }
            dims[dim].disi = disi;
View Full Code Here


    if (mode==2) doIterate2(a, b);
  }

  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);
  }
View Full Code Here

    } while (aa>=0);
  }

  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);
  }
View Full Code Here

      // First drill-down dim, basically adds SHOULD onto
      // the baseQuery:
      //if (DEBUG) {
      //  System.out.println("  dim=0 [" + dims[0].dim + "]");
      //}
      DocIdSetIterator disi = disis[0];
      if (disi != null) {
        docID = disi.docID();
        //if (DEBUG) {
        //  System.out.println("    start docID=" + docID);
        //}
        while (docID < nextChunkStart) {
          int slot = docID & MASK;
          if (docIDs[slot] == docID) {
            //if (DEBUG) {
            //  System.out.println("      set docID=" + docID + " count=2");
            //}
            missingDims[slot] = 1;
            counts[slot] = 2;
          }
          docID = disi.nextDoc();
        }
      }

      for (int dim=1;dim<numDims;dim++) {
        //if (DEBUG) {
        //  System.out.println("  dim=" + dim + " [" + dims[dim].dim + "]");
        //}

        disi = disis[dim];
        if (disi != null) {
          docID = disi.docID();
          //if (DEBUG) {
          //  System.out.println("    start docID=" + docID);
          //}
          while (docID < nextChunkStart) {
            int slot = docID & MASK;
            if (docIDs[slot] == docID && counts[slot] >= dim) {
              // This doc is still in the running...
              // TODO: single-valued dims will always be true
              // below; we could somehow specialize
              if (missingDims[slot] >= dim) {
                //if (DEBUG) {
                //  System.out.println("      set docID=" + docID + " count=" + (dim+2));
                //}
                missingDims[slot] = dim+1;
                counts[slot] = dim+2;
              } else {
                //if (DEBUG) {
                //  System.out.println("      set docID=" + docID + " missing count=" + (dim+1));
                //}
                counts[slot] = dim+1;
              }
            }
            docID = disi.nextDoc();
          }
        }
      }

      // Collect:
View Full Code Here

    throws IOException {
        DocIdSet docIdSet = filter.getDocIdSet(reader);
        if (docIdSet == null) {
          return DocIdSet.EMPTY_DOCIDSET.iterator();
        } else {
          DocIdSetIterator iter = docIdSet.iterator();
          if (iter == null) {
            return DocIdSet.EMPTY_DOCIDSET.iterator();
          } else {
            return iter;
          }
View Full Code Here

            default:
                doChain(result, DEFAULT, dis);
                break;
        }
      } else {
        DocIdSetIterator disi;
        if (dis == null) {
          disi = DocIdSet.EMPTY_DOCIDSET.iterator();
        } else {
          disi = dis.iterator();
          if (disi == null) {
View Full Code Here

      if ( docIdSet == null ) {
        // Since Lucene 4 even the docIdSet could be returned at null to signify an empty match
        return EMPTY_DOCIDSET;
      }
      // build all iterators
      DocIdSetIterator docIdSetIterator = docIdSet.iterator();
      if ( docIdSetIterator == null ) {
        // the Lucene API permits to return null on any iterator for empty matches
        return EMPTY_DOCIDSET;
      }
      iterators[i] = docIdSetIterator;
View Full Code Here

    int i = 0;
    int 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];
      int position = targetPosition;
      if ( !iteratorAlreadyOnTargetPosition( targetPosition, iterator ) ) {
        position = iterator.advance( targetPosition );
      }
      if ( position == DocIdSetIterator.NO_MORE_DOCS ) {
        return result;
      } //exit condition
      if ( position == targetPosition ) {
View Full Code Here

    boolean allIteratorsShareSameFirstTarget = true;

    //iterator initialize, just one "next" for each DocIdSetIterator
    for ( int i = 1; i < iterators.length; i++ ) {
      final DocIdSetIterator iterator = iterators[i];
      final int position = iterator.nextDoc();
      if ( position == DocIdSetIterator.NO_MORE_DOCS ) {
        //current iterator has no values, so skip all
        return DocIdSetIterator.NO_MORE_DOCS;
      }
      if ( targetPosition != position ) {
View Full Code Here

        final int max = base + maxDoc;   // one past the max doc in this segment.

        return new DocIdSet() {
          @Override
          public DocIdSetIterator iterator() throws IOException {
            return new DocIdSetIterator() {
              int pos=base-1;
              int adjustedDoc=-1;

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

TOP

Related Classes of org.apache.lucene.search.DocIdSetIterator

Copyright © 2018 www.massapicom. 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.