public abstract class CandidateMatcher<T extends QueryMatch>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
CandidateMatcher.MatchHolder<T> |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Exception> |
errors |
private java.util.List<CandidateMatcher.MatchHolder<T>> |
matches |
protected IndexSearcher |
searcher
The searcher to run candidate queries against
|
private long |
searchTime |
Constructor and Description |
---|
CandidateMatcher(IndexSearcher searcher)
Creates a new CandidateMatcher for the supplied DocumentBatch
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMatch(T match,
int doc)
Record a match
|
protected void |
copyMatches(CandidateMatcher<T> other)
Copy all matches from another CandidateMatcher
|
protected void |
doFinish()
Called when all monitoring of a batch of documents is complete
|
(package private) MultiMatchingQueries<T> |
finish(long buildTime,
int queryCount) |
protected abstract void |
matchQuery(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) void |
reportError(java.lang.String queryId,
java.lang.Exception e)
Called by the Monitor if running a query throws an Exception
|
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.
|
protected final IndexSearcher searcher
private final java.util.Map<java.lang.String,java.lang.Exception> errors
private final java.util.List<CandidateMatcher.MatchHolder<T extends QueryMatch>> matches
private long searchTime
public CandidateMatcher(IndexSearcher searcher)
searcher
- the IndexSearcher to run queries againstprotected abstract void matchQuery(java.lang.String queryId, Query matchQuery, java.util.Map<java.lang.String,java.lang.String> metadata) throws java.io.IOException
queryId
- the query idmatchQuery
- the query to runmetadata
- the query metadatajava.io.IOException
- on IO errorsprotected final void addMatch(T match, int doc)
match
- a QueryMatch objectpublic abstract T resolve(T match1, T match2)
match1
- the first match foundmatch2
- the second match foundvoid reportError(java.lang.String queryId, java.lang.Exception e)
final MultiMatchingQueries<T> finish(long buildTime, int queryCount)
protected void doFinish()
protected void copyMatches(CandidateMatcher<T> other)