Package org.apache.lucene.search
Class MultiCollector
- java.lang.Object
-
- org.apache.lucene.search.MultiCollector
-
- All Implemented Interfaces:
Collector
public class MultiCollector extends java.lang.Object implements Collector
ACollector
which allows running a search with severalCollector
s. It offers a staticwrap(org.apache.lucene.search.Collector...)
method which accepts a list of collectors and wraps them withMultiCollector
, while filtering out thenull
null ones.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
MultiCollector.MinCompetitiveScoreAwareScorable
private static class
MultiCollector.MultiLeafCollector
-
Field Summary
Fields Modifier and Type Field Description private boolean
cacheScores
private Collector[]
collectors
-
Constructor Summary
Constructors Modifier Constructor Description private
MultiCollector(Collector... collectors)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LeafCollector
getLeafCollector(LeafReaderContext context)
Create a newcollector
to collect the given context.ScoreMode
scoreMode()
Indicates what features are required from the scorer.static Collector
wrap(java.lang.Iterable<? extends Collector> collectors)
Wraps a list ofCollector
s with aMultiCollector
.static Collector
wrap(Collector... collectors)
Seewrap(Iterable)
.
-
-
-
Field Detail
-
cacheScores
private final boolean cacheScores
-
collectors
private final Collector[] collectors
-
-
Constructor Detail
-
MultiCollector
private MultiCollector(Collector... collectors)
-
-
Method Detail
-
wrap
public static Collector wrap(Collector... collectors)
Seewrap(Iterable)
.
-
wrap
public static Collector wrap(java.lang.Iterable<? extends Collector> collectors)
Wraps a list ofCollector
s with aMultiCollector
. This method works as follows:- Filters out the
null
collectors, so they are not used during search time. - If the input contains 1 real collector (i.e. non-
null
), it is returned. - Otherwise the method returns a
MultiCollector
which wraps the non-null
ones.
- Throws:
java.lang.IllegalArgumentException
- if either 0 collectors were input, or all collectors arenull
.
- Filters out the
-
scoreMode
public ScoreMode scoreMode()
Description copied from interface:Collector
Indicates what features are required from the scorer.
-
getLeafCollector
public LeafCollector getLeafCollector(LeafReaderContext context) throws java.io.IOException
Description copied from interface:Collector
Create a newcollector
to collect the given context.- Specified by:
getLeafCollector
in interfaceCollector
- Parameters:
context
- next atomic reader context- Throws:
java.io.IOException
-
-