Package org.apache.lucene.monitor
Class CandidateMatcher<T extends QueryMatch>
- java.lang.Object
-
- org.apache.lucene.monitor.CandidateMatcher<T>
-
- Direct Known Subclasses:
CollectingMatcher,ParallelMatcher,PartitionMatcher
public abstract class CandidateMatcher<T extends QueryMatch> extends java.lang.ObjectClass used to match candidate queries selected by a Presearcher from a Monitor query index.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCandidateMatcher.MatchHolder<T>
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Exception>errorsprivate java.util.List<CandidateMatcher.MatchHolder<T>>matchesprotected IndexSearchersearcherThe searcher to run candidate queries againstprivate longsearchTime
-
Constructor Summary
Constructors Constructor Description CandidateMatcher(IndexSearcher searcher)Creates a new CandidateMatcher for the supplied DocumentBatch
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddMatch(T match, int doc)Record a matchprotected voidcopyMatches(CandidateMatcher<T> other)Copy all matches from another CandidateMatcherprotected voiddoFinish()Called when all monitoring of a batch of documents is complete(package private) MultiMatchingQueries<T>finish(long buildTime, int queryCount)protected abstract voidmatchQuery(java.lang.String queryId, Query matchQuery, java.util.Map<java.lang.String,java.lang.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(package private) voidreportError(java.lang.String queryId, java.lang.Exception e)Called by the Monitor if running a query throws an Exceptionabstract Tresolve(T match1, T match2)If two matches from the same query are found (for example, two branches of a disjunction), combine them.
-
-
-
Field Detail
-
searcher
protected final IndexSearcher searcher
The searcher to run candidate queries against
-
errors
private final java.util.Map<java.lang.String,java.lang.Exception> errors
-
matches
private final java.util.List<CandidateMatcher.MatchHolder<T extends QueryMatch>> matches
-
searchTime
private long searchTime
-
-
Constructor Detail
-
CandidateMatcher
public CandidateMatcher(IndexSearcher searcher)
Creates a new CandidateMatcher for the supplied DocumentBatch- Parameters:
searcher- the IndexSearcher to run queries against
-
-
Method Detail
-
matchQuery
protected abstract void matchQuery(java.lang.String queryId, Query matchQuery, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOExceptionRuns the supplied query against this CandidateMatcher's set of documents, storing any resulting match, and recording the query in the presearcher hits- Parameters:
queryId- the query idmatchQuery- the query to runmetadata- the query metadata- Throws:
java.io.IOException- on IO errors
-
addMatch
protected final void addMatch(T match, int doc)
Record a match- Parameters:
match- a QueryMatch object
-
resolve
public abstract T resolve(T match1, T match2)
If two matches from the same query are found (for example, two branches of a disjunction), combine them.- Parameters:
match1- the first match foundmatch2- the second match found- Returns:
- a Match object that combines the two
-
reportError
void reportError(java.lang.String queryId, java.lang.Exception e)Called by the Monitor if running a query throws an Exception
-
finish
final MultiMatchingQueries<T> finish(long buildTime, int queryCount)
- Returns:
- the matches from this matcher
-
doFinish
protected void doFinish()
Called when all monitoring of a batch of documents is complete
-
copyMatches
protected void copyMatches(CandidateMatcher<T> other)
Copy all matches from another CandidateMatcher
-
-