Package org.apache.lucene.search
Interface QueryCachingPolicy
-
- All Known Implementing Classes:
UsageTrackingQueryCachingPolicy
public interface QueryCachingPolicyA policy defining which filters should be cached. Implementations of this class must be thread-safe.- See Also:
UsageTrackingQueryCachingPolicy,LRUQueryCache- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static QueryCachingPolicyALWAYS_CACHEDeprecated.This policy is inefficient as caching too aggressively disables the ability to skip non-interesting documents.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidonUse(Query query)Callback that is called every time that a cached filter is used.booleanshouldCache(Query query)Whether the givenQueryis worth caching.
-
-
-
Field Detail
-
ALWAYS_CACHE
@Deprecated static final QueryCachingPolicy ALWAYS_CACHE
Deprecated.This policy is inefficient as caching too aggressively disables the ability to skip non-interesting documents. SeeUsageTrackingQueryCachingPolicy.A simple policy that caches all the provided filters on all segments.
-
-
Method Detail
-
onUse
void onUse(Query query)
Callback that is called every time that a cached filter is used. This is typically useful if the policy wants to track usage statistics in order to make decisions.
-
shouldCache
boolean shouldCache(Query query) throws IOException
Whether the givenQueryis worth caching. This method will be called by theQueryCacheto know whether to cache. It will first attempt to load aDocIdSetfrom the cache. If it is not cached yet and this method returns true then a cache entry will be generated. Otherwise an uncached scorer will be returned.- Throws:
IOException
-
-