Example usage for org.apache.solr.search BitsFilteredDocIdSet wrap

List of usage examples for org.apache.solr.search BitsFilteredDocIdSet wrap

Introduction

In this page you can find the example usage for org.apache.solr.search BitsFilteredDocIdSet wrap.

Prototype

public static DocIdSet wrap(DocIdSet set, Bits acceptDocs) 

Source Link

Document

Convenience wrapper method: If acceptDocs == null it returns the original set without wrapping.

Usage

From source file:org.alfresco.solr.query.BitsFilter.java

License:Open Source License

public DocIdSet getDocIdSet(LeafReaderContext context, Bits bits) {
    return BitsFilteredDocIdSet.wrap(new BitDocIdSet(bitSets.get(context.ord)), bits);
}

From source file:org.vootoo.search.function.ValueSourceCollectorFilter.java

License:Apache License

@Override
public DocIdSet getDocIdSet(@SuppressWarnings("rawtypes") final Map context,
        final LeafReaderContext readerContext, Bits acceptDocs) throws IOException {
    collectorFilterable.doSetNextReader(context, readerContext);
    //TODO  check getDocIdSet use
    return BitsFilteredDocIdSet.wrap(new DocIdSet() {
        @Override/* w ww  .  j  a v a 2s  . c om*/
        public long ramBytesUsed() {
            return 0;
        }

        @Override
        public DocIdSetIterator iterator() throws IOException {
            final DocIdSetIterator approximation = DocIdSetIterator.all(readerContext.reader().maxDoc()); // no approximation!
            TwoPhaseIterator twoPhaseIterator = new TwoPhaseIterator(approximation) {
                @Override
                public boolean matches() throws IOException {
                    return collectorFilterable.matches(approximation.docID());
                }

                @Override
                public float matchCost() {
                    return 100; // TODO: use cost of ValueSourceScorer.this.matches()
                }
            };
            return TwoPhaseIterator.asDocIdSetIterator(twoPhaseIterator);
        }

        @Override
        public Bits bits() {
            return null; // don't use random access
        }
    }, acceptDocs);
}