Class IndicesQueryCache.OptionalCachingWeight

java.lang.Object
org.apache.lucene.search.Weight
org.apache.lucene.search.FilterWeight
org.elasticsearch.indices.IndicesQueryCache.OptionalCachingWeight
All Implemented Interfaces:
org.apache.lucene.search.SegmentCacheable
Enclosing class:
IndicesQueryCache

public abstract static class IndicesQueryCache.OptionalCachingWeight extends org.apache.lucene.search.FilterWeight
A Weight that controls whether cache population should proceed for a given leaf. This is useful when multiple threads query different ranges of the same segment concurrently; ideally only one thread populates the cache while others fall back to uncached iteration or wait for caching to complete and then use the cached result.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.lucene.search.Weight

    org.apache.lucene.search.Weight.DefaultBulkScorer, org.apache.lucene.search.Weight.DefaultScorerSupplier
  • Field Summary

    Fields inherited from class org.apache.lucene.search.FilterWeight

    in

    Fields inherited from class org.apache.lucene.search.Weight

    parentQuery
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    OptionalCachingWeight(org.apache.lucene.search.Weight weight)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract Releasable
    startCaching(org.apache.lucene.index.LeafReaderContext leaf)
    Attempts to claim the right to populate the cache for the given leaf.

    Methods inherited from class org.apache.lucene.search.FilterWeight

    count, explain, isCacheable, matches, scorerSupplier

    Methods inherited from class org.apache.lucene.search.Weight

    bulkScorer, getQuery, scorer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OptionalCachingWeight

      protected OptionalCachingWeight(org.apache.lucene.search.Weight weight)
  • Method Details

    • startCaching

      protected abstract Releasable startCaching(org.apache.lucene.index.LeafReaderContext leaf)
      Attempts to claim the right to populate the cache for the given leaf. Returns a Releasable that must be closed once caching is complete, or null if another thread is already caching this segment.