use of org.apache.solr.search.DocSetCollector in project lucene-solr by apache.
the class CommandHandler method computeDocSet.
private DocSet computeDocSet(Query query, ProcessedFilter filter, List<Collector> collectors) throws IOException {
int maxDoc = searcher.maxDoc();
final DocSetCollector docSetCollector = new DocSetCollector(maxDoc);
List<Collector> allCollectors = new ArrayList<>(collectors);
allCollectors.add(docSetCollector);
searchWithTimeLimiter(query, filter, MultiCollector.wrap(allCollectors));
return DocSetUtil.getDocSet(docSetCollector, searcher);
}
use of org.apache.solr.search.DocSetCollector in project lucene-solr by apache.
the class BlockJoin method toParents.
/** childInput may also contain parents (i.e. a parent or below will all roll up to that parent) */
public static DocSet toParents(DocSet childInput, BitDocSet parentList, QueryContext qcontext) throws IOException {
FixedBitSet parentBits = parentList.getBits();
DocSetCollector collector = new DocSetCollector(qcontext.searcher().maxDoc());
DocIterator iter = childInput.iterator();
int currentParent = -1;
while (iter.hasNext()) {
// TODO: skipping
int childDoc = iter.nextDoc();
if (childDoc <= currentParent) {
// we already visited this parent
continue;
}
currentParent = parentBits.nextSetBit(childDoc);
if (currentParent != DocIdSetIterator.NO_MORE_DOCS) {
// only collect the parent the first time we skip to it
collector.collect(currentParent);
}
}
return collector.getDocSet();
}
use of org.apache.solr.search.DocSetCollector in project lucene-solr by apache.
the class BlockJoin method toChildren.
/** acceptDocs will normally be used to avoid deleted documents from being generated as part of the answer DocSet (just use *:*)
* although it can be used to further constrain the generated documents.
*/
public static DocSet toChildren(DocSet parentInput, BitDocSet parentList, DocSet acceptDocs, QueryContext qcontext) throws IOException {
FixedBitSet parentBits = parentList.getBits();
DocSetCollector collector = new DocSetCollector(qcontext.searcher().maxDoc());
DocIterator iter = parentInput.iterator();
while (iter.hasNext()) {
int parentDoc = iter.nextDoc();
if (!parentList.exists(parentDoc) || parentDoc == 0) {
// not a parent, or parent has no children
continue;
}
int prevParent = parentBits.prevSetBit(parentDoc - 1);
for (int childDoc = prevParent + 1; childDoc < parentDoc; childDoc++) {
// only select live docs
if (acceptDocs != null && !acceptDocs.exists(childDoc))
continue;
collector.collect(childDoc);
}
}
return collector.getDocSet();
}
Aggregations