Package org.apache.lucene.monitor
Class WritableQueryIndex
- java.lang.Object
-
- org.apache.lucene.monitor.QueryIndex
-
- org.apache.lucene.monitor.WritableQueryIndex
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
class WritableQueryIndex extends QueryIndex
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
WritableQueryIndex.Indexable
(package private) static class
WritableQueryIndex.MonitorQueryCollector
A Collector that decodes the stored query for each document hit.-
Nested classes/interfaces inherited from class org.apache.lucene.monitor.QueryIndex
QueryIndex.CachePopulator, QueryIndex.DataValues, QueryIndex.FIELDS, QueryIndex.QueryBuilder, QueryIndex.QueryCollector, QueryIndex.QueryTermFilter
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
commitLock
private static BytesRef
EMPTY
protected long
lastPurged
private Presearcher
presearcher
private java.util.Map<java.lang.String,QueryCacheEntry>
purgeCache
private java.util.concurrent.ScheduledExecutorService
purgeExecutor
private java.util.concurrent.locks.ReadWriteLock
purgeLock
protected java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry>
queries
private IndexWriter
writer
-
Fields inherited from class org.apache.lucene.monitor.QueryIndex
decomposer, listeners, manager, serializer, termFilters
-
-
Constructor Summary
Constructors Constructor Description WritableQueryIndex(MonitorConfiguration configuration, Presearcher presearcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.util.List<WritableQueryIndex.Indexable>
buildIndexables(java.util.List<MonitorQuery> updates)
int
cacheSize()
void
clear()
void
close()
void
commit(java.util.List<MonitorQuery> updates)
private void
commitWithoutNotify(java.util.List<MonitorQuery> updates)
void
deleteQueries(java.util.List<java.lang.String> ids)
long
getLastPurged()
int
numDocs()
private void
populateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer)
void
purgeCache()
(package private) void
purgeCache(QueryIndex.CachePopulator populator)
long
search(QueryIndex.QueryBuilder queryBuilder, QueryIndex.QueryCollector matcher)
-
Methods inherited from class org.apache.lucene.monitor.QueryIndex
addListener, getQuery, scan, search
-
-
-
-
Field Detail
-
writer
private final IndexWriter writer
-
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
-
purgeExecutor
private final java.util.concurrent.ScheduledExecutorService purgeExecutor
-
queries
protected volatile java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry> queries
-
lastPurged
protected long lastPurged
-
EMPTY
private static final BytesRef EMPTY
-
-
Constructor Detail
-
WritableQueryIndex
WritableQueryIndex(MonitorConfiguration configuration, Presearcher presearcher) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
commit
public void commit(java.util.List<MonitorQuery> updates) throws java.io.IOException
- Specified by:
commit
in classQueryIndex
- Throws:
java.io.IOException
-
commitWithoutNotify
private void commitWithoutNotify(java.util.List<MonitorQuery> updates) throws java.io.IOException
- Throws:
java.io.IOException
-
populateQueryCache
private void populateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer) throws java.io.IOException
- Throws:
java.io.IOException
-
buildIndexables
private java.util.List<WritableQueryIndex.Indexable> buildIndexables(java.util.List<MonitorQuery> updates)
-
search
public long search(QueryIndex.QueryBuilder queryBuilder, QueryIndex.QueryCollector matcher) throws java.io.IOException
- Specified by:
search
in classQueryIndex
- Throws:
java.io.IOException
-
purgeCache
public void purgeCache() throws java.io.IOException
- Specified by:
purgeCache
in classQueryIndex
- Throws:
java.io.IOException
-
purgeCache
void purgeCache(QueryIndex.CachePopulator populator) throws java.io.IOException
- Specified by:
purgeCache
in classQueryIndex
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Throws:
java.io.IOException
-
numDocs
public int numDocs() throws java.io.IOException
- Specified by:
numDocs
in classQueryIndex
- Throws:
java.io.IOException
-
cacheSize
public int cacheSize()
- Specified by:
cacheSize
in classQueryIndex
-
deleteQueries
public void deleteQueries(java.util.List<java.lang.String> ids) throws java.io.IOException
- Specified by:
deleteQueries
in classQueryIndex
- Throws:
java.io.IOException
-
clear
public void clear() throws java.io.IOException
- Specified by:
clear
in classQueryIndex
- Throws:
java.io.IOException
-
getLastPurged
public long getLastPurged()
- Specified by:
getLastPurged
in classQueryIndex
-
-