Package org.apache.lucene.util

Examples of org.apache.lucene.util.DocIdBitSet


  public DocIdSet integersToDocIdSet(int... integers) {
    BitSet bitset = new BitSet();
    for ( int i : integers ) {
      bitset.set( i );
    }
    return new DocIdBitSet( bitset );
  }
View Full Code Here


    assertTrue( docIdSetsEqual( expected, actual ) );
  }

  @Test
  public void testEmptyDocIdSet() throws Exception {
    DocIdSet idSet1 = new DocIdBitSet( new BitSet() );
    DocIdSet idSet2 = integersToDocIdSet( 0, 5, 6, 10 );
    DocIdSet actual = createAndDocIdSet( idSet1, idSet2 );

    DocIdSet expected = AndDocIdSet.EMPTY_DOCIDSET;
    assertTrue( docIdSetsEqual( expected, actual ) );
View Full Code Here

    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

    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

      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

      @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

    public DocIdSet getDocIdSet(IndexReader r) {
      BitSet b = new BitSet(r.maxDoc());
      for (int i = 0; i < docs.length; i++) {
        b.set(docs[i]);
      }
      return new DocIdBitSet(b);
    }
View Full Code Here

  }

  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
    BitSet bits = new BitSet(reader.maxDoc());
    bits.set(doc);
    return new DocIdBitSet(bits);
  }
View Full Code Here

    return new Filter() {
      public DocIdSet getDocIdSet (IndexReader reader) {
        BitSet bitset = new BitSet(5);
        bitset.set (1);
        bitset.set (3);
        return new DocIdBitSet(bitset);
      }
    };
  }
View Full Code Here

  private static Filter newStaticFilterA() {
    return new Filter() {
      public DocIdSet getDocIdSet (IndexReader reader) {
        BitSet bitset = new BitSet(5);
        bitset.set(0, 5);
        return new DocIdBitSet(bitset);
      }
    };
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.DocIdBitSet

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.