public class MultiCollector extends Object implements Collector
Collector
which allows running a search with several Collector
s. It offers a
static wrap(org.apache.lucene.search.Collector...)
method which accepts a list of collectors and wraps them with MultiCollector
, while filtering out the null
null ones.
NOTE:When mixing collectors that want to skip low-scoring hits (ScoreMode.TOP_SCORES
) with ones that require to see all hits, such as mixing TopScoreDocCollector
and TotalHitCountCollector
, it should be faster to run the query
twice, once for each collector, rather than using this wrapper on a single search.
Modifier and Type | Method and Description |
---|---|
LeafCollector |
getLeafCollector(LeafReaderContext context)
Create a new
collector to collect the given context. |
ScoreMode |
scoreMode()
Indicates what features are required from the scorer.
|
static Collector |
wrap(Collector... collectors)
See
wrap(Iterable) . |
static Collector |
wrap(Iterable<? extends Collector> collectors)
Wraps a list of
Collector s with a MultiCollector . |
public static Collector wrap(Collector... collectors)
wrap(Iterable)
.public static Collector wrap(Iterable<? extends Collector> collectors)
Collector
s with a MultiCollector
. This
method works as follows:
null
collectors, so they are not used
during search time.
null
),
it is returned.
MultiCollector
which wraps the
non-null
ones.
IllegalArgumentException
- if either 0 collectors were input, or all collectors are
null
.public ScoreMode scoreMode()
Collector
public LeafCollector getLeafCollector(LeafReaderContext context) throws IOException
Collector
collector
to collect the given context.getLeafCollector
in interface Collector
context
- next atomic reader contextIOException
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.