public class Monitor extends Object implements Closeable
Modifier and Type | Class and Description |
---|---|
static class |
Monitor.QueryCacheStats
Statistics for the query cache and query index
|
Modifier and Type | Field and Description |
---|---|
protected Presearcher |
presearcher |
Constructor and Description |
---|
Monitor(Analyzer analyzer)
Create a non-persistent Monitor instance with the default term-filtering Presearcher
|
Monitor(Analyzer analyzer,
MonitorConfiguration config)
Create a new Monitor instance with a specific configuration
|
Monitor(Analyzer analyzer,
Presearcher presearcher)
Create a new non-persistent Monitor instance
|
Monitor(Analyzer analyzer,
Presearcher presearcher,
MonitorConfiguration configuration)
Create a new Monitor instance
|
Modifier and Type | Method and Description |
---|---|
void |
addQueryIndexUpdateListener(MonitorUpdateListener listener)
Register a
MonitorUpdateListener that will be notified whenever changes
are made to the Monitor's queryindex |
void |
clear()
Delete all queries from the monitor
|
void |
close() |
<T extends QueryMatch> |
debug(Document[] docs,
MatcherFactory<T> factory)
Match a DocumentBatch against the queries stored in the Monitor, also returning information
about which queries were selected by the presearcher, and why.
|
<T extends QueryMatch> |
debug(Document doc,
MatcherFactory<T> factory)
Match a single
Document against the queries stored in the Monitor, also returning information
about which queries were selected by the presearcher, and why. |
void |
deleteById(List<String> queryIds)
Delete queries from the monitor by ID
|
void |
deleteById(String... queryIds)
Delete queries from the monitor by ID
|
int |
getDisjunctCount() |
MonitorQuery |
getQuery(String queryId)
Get the MonitorQuery for a given query id
|
Monitor.QueryCacheStats |
getQueryCacheStats() |
int |
getQueryCount() |
Set<String> |
getQueryIds() |
<T extends QueryMatch> |
match(Document[] docs,
MatcherFactory<T> factory)
Match an array of
Document s against the queryindex, calling a CandidateMatcher produced by the
supplied MatcherFactory for each possible matching query. |
<T extends QueryMatch> |
match(Document doc,
MatcherFactory<T> factory)
Match a single
Document against the queryindex, calling a CandidateMatcher produced by the
supplied MatcherFactory for each possible matching query. |
void |
purgeCache()
Remove unused queries from the query cache.
|
void |
register(Iterable<MonitorQuery> queries)
Add new queries to the monitor
|
void |
register(MonitorQuery... queries)
Add new queries to the monitor
|
protected final Presearcher presearcher
public Monitor(Analyzer analyzer) throws IOException
analyzer
- to analyze Document
s at match timeIOException
public Monitor(Analyzer analyzer, Presearcher presearcher) throws IOException
analyzer
- to analyze Document
s at match timepresearcher
- the presearcher to useIOException
public Monitor(Analyzer analyzer, MonitorConfiguration config) throws IOException
analyzer
- to analyze Document
s at match timeconfig
- the configurationIOException
public Monitor(Analyzer analyzer, Presearcher presearcher, MonitorConfiguration configuration) throws IOException
analyzer
- to analyze Document
s at match timepresearcher
- the presearcher to useconfiguration
- the configurationIOException
public void addQueryIndexUpdateListener(MonitorUpdateListener listener)
MonitorUpdateListener
that will be notified whenever changes
are made to the Monitor's queryindexlistener
- listener to registerpublic Monitor.QueryCacheStats getQueryCacheStats()
public void purgeCache() throws IOException
This is normally called from a background thread at a rate set by configurePurgeFrequency().
IOException
- on IO errorspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void register(Iterable<MonitorQuery> queries) throws IOException
queries
- the MonitorQueries to addIOException
public void register(MonitorQuery... queries) throws IOException
queries
- the MonitorQueries to addIOException
- on IO errorspublic void deleteById(List<String> queryIds) throws IOException
queryIds
- the IDs to deleteIOException
- on IO errorspublic void deleteById(String... queryIds) throws IOException
queryIds
- the IDs to deleteIOException
- on IO errorspublic void clear() throws IOException
IOException
- on IO errorspublic <T extends QueryMatch> MultiMatchingQueries<T> match(Document[] docs, MatcherFactory<T> factory) throws IOException
Document
s against the queryindex, calling a CandidateMatcher
produced by the
supplied MatcherFactory
for each possible matching query.T
- the type of QueryMatch
to returndocs
- the DocumentBatch to matchfactory
- a MatcherFactory
to use to create a CandidateMatcher
for the match runMatchingQueries
object summarizing the match run.IOException
- on IO errorspublic <T extends QueryMatch> MatchingQueries<T> match(Document doc, MatcherFactory<T> factory) throws IOException
Document
against the queryindex, calling a CandidateMatcher
produced by the
supplied MatcherFactory
for each possible matching query.T
- the type of QueryMatch
to returndoc
- the InputDocument to matchfactory
- a MatcherFactory
to use to create a CandidateMatcher
for the match runMatchingQueries
object summarizing the match run.IOException
- on IO errorspublic MonitorQuery getQuery(String queryId) throws IOException
queryId
- the id of the query to getIOException
- on IO errorsIllegalStateException
- if queries are not stored in the queryindexpublic int getDisjunctCount()
public int getQueryCount() throws IOException
IOException
- on IO errorspublic Set<String> getQueryIds() throws IOException
IOException
- on IO errorspublic <T extends QueryMatch> PresearcherMatches<T> debug(Document[] docs, MatcherFactory<T> factory) throws IOException
T
- the type of QueryMatch produced by the CandidateMatcherdocs
- a DocumentBatch to match against the indexfactory
- a MatcherFactory
to use to create a CandidateMatcher
for the match runPresearcherMatches
object containing debug informationIOException
- on IO errorspublic <T extends QueryMatch> PresearcherMatches<T> debug(Document doc, MatcherFactory<T> factory) throws IOException
Document
against the queries stored in the Monitor, also returning information
about which queries were selected by the presearcher, and why.T
- the type of QueryMatch produced by the CandidateMatcherdoc
- an InputDocument to match against the indexfactory
- a MatcherFactory
to use to create a CandidateMatcher
for the match runPresearcherMatches
object containing debug informationIOException
- on IO errorsCopyright © 2000-2021 Apache Software Foundation. All Rights Reserved.