Package org.apache.lucene.monitor
Class QueryIndex
- java.lang.Object
-
- org.apache.lucene.monitor.QueryIndex
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
class QueryIndex extends java.lang.Object implements java.io.Closeable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceQueryIndex.CachePopulator(package private) static classQueryIndex.DataValues(package private) static classQueryIndex.FIELDSprivate static classQueryIndex.Indexable(package private) static classQueryIndex.MonitorQueryCollectorA Collector that decodes the stored query for each document hit.(package private) static interfaceQueryIndex.QueryBuilder(package private) static interfaceQueryIndex.QueryCollector(package private) static classQueryIndex.QueryTermFilterprivate classQueryIndex.TermsHashBuilder
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectcommitLockprivate QueryDecomposerdecomposerprivate static BytesRefEMPTYprivate SearcherManagermanagerprivate Presearcherpresearcherprivate java.util.Map<java.lang.String,QueryCacheEntry>purgeCacheprivate java.util.concurrent.locks.ReadWriteLockpurgeLockprivate java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry>queriesprivate MonitorQuerySerializerserializer(package private) java.util.Map<IndexReader.CacheKey,QueryIndex.QueryTermFilter>termFiltersprivate IndexWriterwriter
-
Constructor Summary
Constructors Constructor Description QueryIndex(MonitorConfiguration config, Presearcher presearcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.List<QueryIndex.Indexable>buildIndexables(java.util.List<MonitorQuery> updates)(package private) intcacheSize()(package private) voidclear()voidclose()(package private) voidcommit(java.util.List<MonitorQuery> updates)(package private) voiddeleteQueries(java.lang.Iterable<java.lang.String> ids)(package private) MonitorQuerygetQuery(java.lang.String queryId)(package private) intnumDocs()private voidpopulateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer)(package private) voidpurgeCache()private voidpurgeCache(QueryIndex.CachePopulator populator)Remove unused queries from the query cache.(package private) voidscan(QueryIndex.QueryCollector matcher)(package private) longsearch(QueryIndex.QueryBuilder queryBuilder, QueryIndex.QueryCollector matcher)(package private) longsearch(Query query, QueryIndex.QueryCollector matcher)
-
-
-
Field Detail
-
writer
private final IndexWriter writer
-
manager
private final SearcherManager manager
-
decomposer
private final QueryDecomposer decomposer
-
serializer
private final MonitorQuerySerializer serializer
-
presearcher
private final Presearcher presearcher
-
purgeCache
private volatile java.util.Map<java.lang.String,QueryCacheEntry> purgeCache
-
purgeLock
private final java.util.concurrent.locks.ReadWriteLock purgeLock
-
commitLock
private final java.lang.Object commitLock
-
queries
private volatile java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry> queries
-
termFilters
final java.util.Map<IndexReader.CacheKey,QueryIndex.QueryTermFilter> termFilters
-
EMPTY
private static final BytesRef EMPTY
-
-
Constructor Detail
-
QueryIndex
QueryIndex(MonitorConfiguration config, Presearcher presearcher) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
populateQueryCache
private void populateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer) throws java.io.IOException
- Throws:
java.io.IOException
-
commit
void commit(java.util.List<MonitorQuery> updates) throws java.io.IOException
- Throws:
java.io.IOException
-
buildIndexables
private java.util.List<QueryIndex.Indexable> buildIndexables(java.util.List<MonitorQuery> updates)
-
getQuery
MonitorQuery getQuery(java.lang.String queryId) throws java.io.IOException
- Throws:
java.io.IOException
-
scan
void scan(QueryIndex.QueryCollector matcher) throws java.io.IOException
- Throws:
java.io.IOException
-
search
long search(Query query, QueryIndex.QueryCollector matcher) throws java.io.IOException
- Throws:
java.io.IOException
-
search
long search(QueryIndex.QueryBuilder queryBuilder, QueryIndex.QueryCollector matcher) throws java.io.IOException
- Throws:
java.io.IOException
-
purgeCache
void purgeCache() throws java.io.IOException- Throws:
java.io.IOException
-
purgeCache
private void purgeCache(QueryIndex.CachePopulator populator) throws java.io.IOException
Remove unused queries from the query cache.This is normally called from a background thread at a rate set by configurePurgeFrequency().
- Throws:
java.io.IOException- on IO errors
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
numDocs
int numDocs()
-
cacheSize
int cacheSize()
-
deleteQueries
void deleteQueries(java.lang.Iterable<java.lang.String> ids) throws java.io.IOException- Throws:
java.io.IOException
-
clear
void clear() throws java.io.IOException- Throws:
java.io.IOException
-
-