List of usage examples for org.apache.lucene.search DocIdSetIterator all
public static final DocIdSetIterator all(int maxDoc)
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 w w . j a v a 2s . co m*/ 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); }