Examples of DocIdBitSet


Examples of org.apache.lucene.util.DocIdBitSet

    final BitSet rnd = sets[random().nextInt(sets.length)];
    Query q = new ConstantScoreQuery(new Filter() {
      @Override
      public DocIdSet getDocIdSet (AtomicReaderContext context, Bits acceptDocs) {
        assertNull("acceptDocs should be null, as we have an index without deletions", acceptDocs);
        return new DocIdBitSet(rnd);
      }
    });
    bq.add(q, BooleanClause.Occur.MUST);
    if (validate) {
      if (result==null) result = (BitSet)rnd.clone();
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

      public DocIdSet getDocIdSet (AtomicReaderContext context, Bits acceptDocs) {
        if (acceptDocs == null) acceptDocs = new Bits.MatchAllBits(5);
        BitSet bitset = new BitSet(5);
        if (acceptDocs.get(1)) bitset.set(1);
        if (acceptDocs.get(3)) bitset.set(3);
        return new DocIdBitSet(bitset);
      }
    };
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

      @Override
      public DocIdSet getDocIdSet (AtomicReaderContext context, Bits acceptDocs) {
        assertNull("acceptDocs should be null, as we have an index without deletions", acceptDocs);
        BitSet bitset = new BitSet(5);
        bitset.set(0, 5);
        return new DocIdBitSet(bitset);
      }
    };
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

    for (int position : enabledBits ) {
      // a minimal check for input duplicates:
      assertFalse( set.get( position ) );
      set.set( position );
    }
    return new DocIdBitSet( set );
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

 
  public void onRandomBigArraysTest(long randomSeed) {
    List<BitSet> filtersData = makeRandomBitSetList( randomSeed, 4, 1000000, 1500000 );
    BitSet expectedBitset = applyANDOnBitSets( filtersData );
    List<DocIdSet> filters = toDocIdSetList( filtersData );
    DocIdBitSet expectedDocIdSet = new DocIdBitSet( expectedBitset );
    DocIdSet testedSet = new AndDocIdSet( filters, 1500000 );
    assertTrue( docIdSetsEqual(expectedDocIdSet, testedSet) );
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

  }
 
  private static List<DocIdSet> toDocIdSetList(List<BitSet> filtersData) {
    List<DocIdSet> docIdSets = new ArrayList<DocIdSet>( filtersData.size() );
    for (BitSet bitSet : filtersData) {
      docIdSets.add ( new DocIdBitSet(bitSet) );
    }
    return docIdSets;
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

    DocIdSet andedByIterationResult = null;
    {
      long startTime = System.currentTimeMillis();
      for ( int i=0; i<1000; i++ ) {
        BitSet expectedBitset = applyANDOnBitSets( filtersData );
        andedByBitsResult = new DocIdBitSet( expectedBitset );
        // iteration is needed to have a fair comparison with other impl:
        iterateOnResults( andedByBitsResult );
      }
      long totalTimeMs = System.currentTimeMillis() - startTime;
      System.out.println( "Time to \"AND " + listSize +
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

  public DocIdSet arrayToDocIdSet(List<Integer> docIdList) {
    BitSet bitset = new BitSet();
    for (int i : docIdList) {
      bitset.set(i);
    }
    return new DocIdBitSet(bitset);
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

   * @return a DocIdSet that provides the documents which should be
   * permitted or prohibited in search results.
   * @see DocIdBitSet
   */
  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
    return new DocIdBitSet(bits(reader));
  }
View Full Code Here

Examples of org.apache.lucene.util.DocIdBitSet

    if (cached != null) {
      if (cached instanceof DocIdSet)
        return (DocIdSet) cached;
      else
        return new DocIdBitSet((BitSet) cached);
    }

    final DocIdSet docIdSet = filter.getDocIdSet(reader);

    synchronized (cache) {  // update cache
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.