public static class FilterCachingPolicy.CacheOnLargeSegments extends Object implements FilterCachingPolicy
FilterCachingPolicy.CacheOnLargeSegments
Modifier and Type | Field and Description |
---|---|
static FilterCachingPolicy.CacheOnLargeSegments |
DEFAULT
FilterCachingPolicy.CacheOnLargeSegments instance that only caches on segments that
account for more than 3% of the total index size. |
ALWAYS_CACHE
Constructor and Description |
---|
FilterCachingPolicy.CacheOnLargeSegments(float minSizeRatio)
Create a
FilterCachingPolicy.CacheOnLargeSegments instance that only caches on a
given segment if its number of documents 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(Filter filter)
Callback that is called every time that a cached filter is used.
|
boolean |
shouldCache(Filter filter,
LeafReaderContext context,
DocIdSet set)
Whether the given
DocIdSet should be cached on a given segment. |
public static final FilterCachingPolicy.CacheOnLargeSegments DEFAULT
FilterCachingPolicy.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 LRUFilterCache
perform better when the number of cached segments is low).public FilterCachingPolicy.CacheOnLargeSegments(float minSizeRatio)
FilterCachingPolicy.CacheOnLargeSegments
instance that only caches on a
given segment if its number of documents divided by the total number of
documents in the index is greater than or equal to
minSizeRatio
.public void onUse(Filter filter)
FilterCachingPolicy
onUse
in interface FilterCachingPolicy
public boolean shouldCache(Filter filter, LeafReaderContext context, DocIdSet set) throws IOException
FilterCachingPolicy
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 FilterCachingPolicy
IOException
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.