Package org.apache.lucene.util

Examples of org.apache.lucene.util.DocIdBitSet


    // a filter that only allows through the first hit
    Filter filt = new Filter() {
      public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
        BitSet bs = new BitSet(reader.maxDoc());
        bs.set(docs1.scoreDocs[0].doc);
        return new DocIdBitSet(bs);
      }
    };

    TopDocs docs2 = full.search(queryE, filt, nDocs, sort);
   
View Full Code Here


public class MockFilter extends Filter {
  private boolean wasCalled;

  public DocIdSet getDocIdSet(IndexReader reader) {
    wasCalled = true;
    return new DocIdBitSet(new BitSet());
  }
View Full Code Here

   * @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

  BitSet addClause(BooleanQuery bq, BitSet result) {
    final BitSet rnd = sets[r.nextInt(sets.length)];
    Query q = new ConstantScoreQuery(new Filter() {
      public DocIdSet getDocIdSet(IndexReader reader) {
        return new DocIdBitSet(rnd);
      };
    });
    bq.add(q, BooleanClause.Occur.MUST);
    if (validate) {
      if (result==null) result = (BitSet)rnd.clone();
View Full Code Here

   *         no documents will be accepted by this Filter.
   *
   * @see DocIdBitSet
   */
  public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
    return new DocIdBitSet(bits(reader));
  }
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

  BitSet addClause(BooleanQuery bq, BitSet result) {
    final BitSet rnd = sets[r.nextInt(sets.length)];
    Query q = new ConstantScoreQuery(new Filter() {
      public DocIdSet getDocIdSet(IndexReader reader) {
        return new DocIdBitSet(rnd);
      };
    });
    bq.add(q, BooleanClause.Occur.MUST);
    if (validate) {
      if (result==null) result = (BitSet)rnd.clone();
View Full Code Here

    Filter filt = new Filter() {
      public DocIdSet getDocIdSet(IndexReader reader) throws IOException {
        BitSet bs = new BitSet(reader.maxDoc());
        bs.set(0, reader.maxDoc());
        bs.set(docs1.scoreDocs[0].doc);
        return new DocIdBitSet(bs);
      }
    };

    TopDocs docs2 = full.search(queryE, filt, nDocs, sort);
   
View Full Code Here

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

    missCount++;

    // cache miss
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.