public final class XUsageTrackingQueryCachingPolicy extends Object implements org.apache.lucene.search.QueryCachingPolicy
QueryCachingPolicy
that tracks usage statistics of recently-used
filters in order to decide on which filters are worth caching.
It also uses some heuristics on segments, filters and the doc id sets that
they produce in order to cache more aggressively when the execution cost
significantly outweighs the caching overhead.Constructor and Description |
---|
XUsageTrackingQueryCachingPolicy()
Create a new instance with an history size of 256.
|
XUsageTrackingQueryCachingPolicy(int minIndexSize,
float minSizeRatio,
int historySize)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected int |
minFrequencyToCache(org.apache.lucene.search.Query query)
For a given query, return how many times it should appear in the history
before being cached.
|
void |
onUse(org.apache.lucene.search.Query query) |
boolean |
shouldCache(org.apache.lucene.search.Query query,
org.apache.lucene.index.LeafReaderContext context) |
public XUsageTrackingQueryCachingPolicy(int minIndexSize, float minSizeRatio, int historySize)
minIndexSize
- the minimum size of the top-level indexminSizeRatio
- the minimum size ratio for segments to be cached, see QueryCachingPolicy.CacheOnLargeSegments
historySize
- the number of recently used filters to trackpublic XUsageTrackingQueryCachingPolicy()
protected int minFrequencyToCache(org.apache.lucene.search.Query query)
public void onUse(org.apache.lucene.search.Query query)
onUse
in interface org.apache.lucene.search.QueryCachingPolicy
public boolean shouldCache(org.apache.lucene.search.Query query, org.apache.lucene.index.LeafReaderContext context) throws IOException
shouldCache
in interface org.apache.lucene.search.QueryCachingPolicy
IOException
Copyright © 2009–2016. All rights reserved.