public static class QueryCachingPolicy.CacheOnLargeSegments extends Object implements QueryCachingPolicy
QueryCachingPolicy.CacheOnLargeSegments
Modifier and Type | Field and Description |
---|---|
static QueryCachingPolicy.CacheOnLargeSegments |
DEFAULT
QueryCachingPolicy.CacheOnLargeSegments instance that only caches on segments that
account for more than 3% of the total index size. |
ALWAYS_CACHE
Constructor and Description |
---|
CacheOnLargeSegments(int minIndexSize,
float minSizeRatio)
Create a
QueryCachingPolicy.CacheOnLargeSegments instance that only caches on a
given segment if the total number of documents in the index is greater
than minIndexSize and the number of documents in the segment
divided by the total number of documents in the index is greater than
or equal to minSizeRatio . |
Modifier and Type | Method and Description |
---|---|
void |
onUse(Query query)
Callback that is called every time that a cached filter is used.
|
boolean |
shouldCache(Query query,
LeafReaderContext context)
Whether the given
DocIdSet should be cached on a given segment. |
public static final QueryCachingPolicy.CacheOnLargeSegments DEFAULT
QueryCachingPolicy.CacheOnLargeSegments
instance that only caches on segments that
account for more than 3% of the total index size. This should guarantee
that all segments from the upper tier
will be
cached while ensuring that at most 33 segments can make it to
the cache (given that some implementations such as LRUQueryCache
perform better when the number of cached segments is low).public CacheOnLargeSegments(int minIndexSize, float minSizeRatio)
QueryCachingPolicy.CacheOnLargeSegments
instance that only caches on a
given segment if the total number of documents in the index is greater
than minIndexSize
and the number of documents in the segment
divided by the total number of documents in the index is greater than
or equal to minSizeRatio
.public void onUse(Query query)
QueryCachingPolicy
onUse
in interface QueryCachingPolicy
public boolean shouldCache(Query query, LeafReaderContext context) throws IOException
QueryCachingPolicy
DocIdSet
should be cached on a given segment.
This method will be called on each leaf context to know if the filter
should be cached on this particular leaf. The filter cache will first
attempt to load a DocIdSet
from the cache. If it is not cached
yet and this method returns true then a cache entry will be
generated. Otherwise an uncached set will be returned.shouldCache
in interface QueryCachingPolicy
IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.