Examples of DocIdSet


Examples of org.apache.lucene.search.DocIdSet

        assertEquals("invalid doc ID: " + iter.getDocID(), doc++, iter.getDocID());
        assertEquals("invalid score: " + iter.getScore(), ScoredDocIDsIterator.DEFAULT_SCORE, iter.getScore(), 0.0f);
      }
      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));
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

      return maxDoc;
    }

    @Override
    public DocIdSet getDocIDs() {
      return new DocIdSet() {

        @Override
        public boolean isCacheable() {
          return true;
        }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

      return reader.numDocs();
    }

    @Override
    public DocIdSet getDocIDs() {
      return new DocIdSet() {

        @Override
        public boolean isCacheable() {
          return true;
        }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

      // NOTE: we cannot pass acceptDocs here because this
      // will (most likely, justifiably) cause the filter to
      // not return a FixedBitSet but rather a
      // BitsFilteredDocIdSet.  Instead, we filter by
      // acceptDocs when we score:
      final DocIdSet parents = parentsFilter.getDocIdSet(readerContext, null);

      if (parents == null) {
        // No matches
        return null;
      }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

    wrappedComparator.setBottom(slot);
  }

  @Override
  public FieldComparator<Object> setNextReader(AtomicReaderContext context) throws IOException {
    DocIdSet innerDocuments = childFilter.getDocIdSet(context, null);
    if (isEmpty(innerDocuments)) {
      this.childDocuments = null;
    } else if (innerDocuments instanceof FixedBitSet) {
      this.childDocuments = (FixedBitSet) innerDocuments;
    } else {
      DocIdSetIterator iterator = innerDocuments.iterator();
      if (iterator != null) {
        this.childDocuments = toFixedBitSet(iterator, context.reader().maxDoc());
      } else {
        childDocuments = null;
      }
    }
    DocIdSet rootDocuments = parentFilter.getDocIdSet(context, null);
    if (isEmpty(rootDocuments)) {
      this.parentDocuments = null;
    } else if (rootDocuments instanceof FixedBitSet) {
      this.parentDocuments = (FixedBitSet) rootDocuments;
    } else {
      DocIdSetIterator iterator = rootDocuments.iterator();
      if (iterator != null) {
        this.parentDocuments = toFixedBitSet(iterator, context.reader().maxDoc());
      } else {
        this.parentDocuments = null;
      }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

    final AtomicReaderContext readerContext = reader.getContext();
    boolean any = false;
    for (QueryAndLimit ent : queriesIter) {
      Query query = ent.query;
      int limit = ent.limit;
      final DocIdSet docs = new QueryWrapperFilter(query).getDocIdSet(readerContext, reader.getLiveDocs());
      if (docs != null) {
        final DocIdSetIterator it = docs.iterator();
        if (it != null) {
          while(true)  {
            int doc = it.nextDoc();
            if (doc >= limit) {
              break;
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {

    final double[] latitudeValues = FieldCache.DEFAULT.getDoubles( reader, getLatitudeField() );
    final double[] longitudeValues = FieldCache.DEFAULT.getDoubles( reader, getLongitudeField() );

    DocIdSet docs = previousFilter.getDocIdSet( reader );

    if ( ( docs == null ) || ( docs.iterator() == null ) ) {
      return null;
    }

    return new FilteredDocIdSet( docs ) {
      @Override
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

    this.cache = new SoftLimitMRUCache( size, softRefSize );
  }

  @Override
  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
    DocIdSet cached = (DocIdSet) cache.get( reader );
    if ( cached != null ) {
      return cached;
    }
    synchronized ( cache ) {
      cached = (DocIdSet) cache.get( reader );
      if ( cached != null ) {
        return cached;
      }
      final DocIdSet docIdSet = filter.getDocIdSet( reader );
      cache.put( reader, docIdSet );
      return docIdSet;
    }
  }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

    this.cache = new SoftLimitMRUCache( size, softRefSize );
  }

  @Override
  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
    DocIdSet cached = (DocIdSet) cache.get( reader );
    if ( cached != null ) {
      return cached;
    }
    synchronized ( cache ) {
      cached = (DocIdSet) cache.get( reader );
      if ( cached != null ) {
        return cached;
      }
      final DocIdSet docIdSet = filter.getDocIdSet( reader );
      cache.put( reader, docIdSet );
      return docIdSet;
    }
  }
View Full Code Here

Examples of org.apache.lucene.search.DocIdSet

    w2.close();
   
    TermsFilter tf = new TermsFilter(new Term(fieldName, "content1"));
    MultiReader multi = new MultiReader(reader1, reader2);
    for (AtomicReaderContext context : multi.leaves()) {
      DocIdSet docIdSet = tf.getDocIdSet(context, context.reader().getLiveDocs());
      if (context.reader().docFreq(new Term(fieldName, "content1")) == 0) {
        assertNull(docIdSet);
      } else {
        FixedBitSet bits = (FixedBitSet) docIdSet;
        assertTrue("Must be >= 0", bits.cardinality() >= 0);     
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.