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 interface
QueryIndex.CachePopulator
(package private) static class
QueryIndex.DataValues
(package private) static class
QueryIndex.FIELDS
private static class
QueryIndex.Indexable
(package private) static class
QueryIndex.MonitorQueryCollector
A Collector that decodes the stored query for each document hit.(package private) static interface
QueryIndex.QueryBuilder
(package private) static interface
QueryIndex.QueryCollector
(package private) static class
QueryIndex.QueryTermFilter
private class
QueryIndex.TermsHashBuilder
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
commitLock
private QueryDecomposer
decomposer
private static BytesRef
EMPTY
private SearcherManager
manager
private Presearcher
presearcher
private java.util.Map<java.lang.String,QueryCacheEntry>
purgeCache
private java.util.concurrent.locks.ReadWriteLock
purgeLock
private java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry>
queries
private MonitorQuerySerializer
serializer
(package private) java.util.Map<IndexReader.CacheKey,QueryIndex.QueryTermFilter>
termFilters
private IndexWriter
writer
-
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) int
cacheSize()
(package private) void
clear()
void
close()
(package private) void
commit(java.util.List<MonitorQuery> updates)
(package private) void
deleteQueries(java.lang.Iterable<java.lang.String> ids)
(package private) MonitorQuery
getQuery(java.lang.String queryId)
(package private) int
numDocs()
private void
populateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer)
(package private) void
purgeCache()
private void
purgeCache(QueryIndex.CachePopulator populator)
Remove unused queries from the query cache.(package private) void
scan(QueryIndex.QueryCollector matcher)
(package private) long
search(QueryIndex.QueryBuilder queryBuilder, QueryIndex.QueryCollector matcher)
(package private) long
search(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:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in 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
-
-