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 classWritableQueryIndex.Indexable(package private) static classWritableQueryIndex.MonitorQueryCollectorA 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.ObjectcommitLockprivate static BytesRefEMPTYprotected longlastPurgedprivate Presearcherpresearcherprivate java.util.Map<java.lang.String,QueryCacheEntry>purgeCacheprivate java.util.concurrent.ScheduledExecutorServicepurgeExecutorprivate java.util.concurrent.locks.ReadWriteLockpurgeLockprotected java.util.concurrent.ConcurrentMap<java.lang.String,QueryCacheEntry>queriesprivate IndexWriterwriter-
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)intcacheSize()voidclear()voidclose()voidcommit(java.util.List<MonitorQuery> updates)private voidcommitWithoutNotify(java.util.List<MonitorQuery> updates)voiddeleteQueries(java.util.List<java.lang.String> ids)longgetLastPurged()intnumDocs()private voidpopulateQueryCache(MonitorQuerySerializer serializer, QueryDecomposer decomposer)voidpurgeCache()(package private) voidpurgeCache(QueryIndex.CachePopulator populator)longsearch(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:
commitin 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:
searchin classQueryIndex- Throws:
java.io.IOException
-
purgeCache
public void purgeCache() throws java.io.IOException- Specified by:
purgeCachein classQueryIndex- Throws:
java.io.IOException
-
purgeCache
void purgeCache(QueryIndex.CachePopulator populator) throws java.io.IOException
- Specified by:
purgeCachein 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:
numDocsin classQueryIndex- Throws:
java.io.IOException
-
cacheSize
public int cacheSize()
- Specified by:
cacheSizein classQueryIndex
-
deleteQueries
public void deleteQueries(java.util.List<java.lang.String> ids) throws java.io.IOException- Specified by:
deleteQueriesin classQueryIndex- Throws:
java.io.IOException
-
clear
public void clear() throws java.io.IOException- Specified by:
clearin classQueryIndex- Throws:
java.io.IOException
-
getLastPurged
public long getLastPurged()
- Specified by:
getLastPurgedin classQueryIndex
-
-