T
- the type of QueryMatch to returnpublic class PartitionMatcher<T extends QueryMatch> extends CandidateMatcher<T>
This class delegates the matching to separate CandidateMatcher classes, built from a passed in MatcherFactory.
Use this if your query sets contain large numbers of very fast queries, where
the synchronization overhead of ParallelMatcher
can outweigh the benefit of multithreading.
ParallelMatcher
searcher
Modifier and Type | Method and Description |
---|---|
protected void |
doFinish()
Called when all monitoring of a batch of documents is complete
|
static <T extends QueryMatch> |
factory(ExecutorService executor,
MatcherFactory<T> matcherFactory)
Create a new MatcherFactory for a PartitionMatcher
|
static <T extends QueryMatch> |
factory(ExecutorService executor,
MatcherFactory<T> matcherFactory,
int threads)
Create a new MatcherFactory for a PartitionMatcher
|
protected void |
matchQuery(String queryId,
Query matchQuery,
Map<String,String> metadata)
Runs the supplied query against this CandidateMatcher's set of documents, storing any
resulting match, and recording the query in the presearcher hits
|
T |
resolve(T match1,
T match2)
If two matches from the same query are found (for example, two branches of a disjunction),
combine them.
|
addMatch, copyMatches
protected void matchQuery(String queryId, Query matchQuery, Map<String,String> metadata)
CandidateMatcher
matchQuery
in class CandidateMatcher<T extends QueryMatch>
queryId
- the query idmatchQuery
- the query to runmetadata
- the query metadatapublic T resolve(T match1, T match2)
CandidateMatcher
resolve
in class CandidateMatcher<T extends QueryMatch>
match1
- the first match foundmatch2
- the second match foundprotected void doFinish()
CandidateMatcher
doFinish
in class CandidateMatcher<T extends QueryMatch>
public static <T extends QueryMatch> MatcherFactory<T> factory(ExecutorService executor, MatcherFactory<T> matcherFactory, int threads)
T
- the type of QueryMatch generatedexecutor
- the ExecutorService to usematcherFactory
- the MatcherFactory to use to create submatchersthreads
- the number of threads to usepublic static <T extends QueryMatch> MatcherFactory<T> factory(ExecutorService executor, MatcherFactory<T> matcherFactory)
This factory will create a PartitionMatcher that uses as many threads as there are cores available
to the JVM (as determined by Runtime.getRuntime().availableProcessors()
).
T
- the type of QueryMatch generatedexecutor
- the ExecutorService to usematcherFactory
- the MatcherFactory to use to create submatchersCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.