org.apache.solr.search.stats

## Class LocalStatsCache

- java.lang.Object
- - org.apache.solr.search.stats.StatsCache
  - - org.apache.solr.search.stats.LocalStatsCache

- All Implemented Interfaces:
    PluginInfoInitialized

      public class LocalStatsCache
      extends StatsCache

  Default implementation that simply ignores global term statistics, and always uses local term statistics.

- - ### Field Summary

    - ### Fields inherited from class org.apache.solr.search.stats.StatsCache

      `COL_STATS_KEY, TERM_STATS_KEY, TERMS_KEY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalStatsCache()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `StatsSource` | `get(SolrQueryRequest req)` Prepare local `StatsSource` to provide stats information to perform local scoring (to be precise, to build a local `Weight` from the query).
    `void` | `init(PluginInfo info)`
    `void` | `mergeToGlobalStats(SolrQueryRequest req, List<ShardResponse> responses)` Process shard responses that contain partial local stats.
    `void` | `receiveGlobalStats(SolrQueryRequest req)` Receive global stats data from the master and update a local cache of stats with this global data.
    `ShardRequest` | `retrieveStatsRequest(ResponseBuilder rb)` Creates a `ShardRequest` to retrieve per-shard stats related to the current query and the current state of the requester's `StatsCache`.
    `void` | `returnLocalStats(ResponseBuilder rb, SolrIndexSearcher searcher)` Prepare a local (from the local shard) response to a "retrieve stats" shard request.
    `void` | `sendGlobalStats(ResponseBuilder rb, ShardRequest outgoing)` Prepare global stats data to be sent out to shards in this request.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalStatsCache

          public LocalStatsCache()

  - ### Method Detail

    - #### get

          public StatsSource get(SolrQueryRequest req)

      Description copied from class: `StatsCache`
      Prepare local `StatsSource` to provide stats information to perform local scoring (to be precise, to build a local `Weight` from the query).
      Specified by:
        `get` in class `StatsCache`
      Parameters:
        `req` - query request
      Returns:
        an instance of `StatsSource` to use in creating a query `Weight`

    - #### init

          public void init(PluginInfo info)

    - #### retrieveStatsRequest

          public ShardRequest retrieveStatsRequest(ResponseBuilder rb)

      Description copied from class: `StatsCache`
      Creates a `ShardRequest` to retrieve per-shard stats related to the current query and the current state of the requester's `StatsCache`.
      Specified by:
        `retrieveStatsRequest` in class `StatsCache`
      Parameters:
        `rb` - contains current request
      Returns:
        shard request to retrieve stats for terms in the current request, or null if no additional request is needed (e.g. if the information in global cache is already sufficient to satisfy this request).

    - #### mergeToGlobalStats

          public void mergeToGlobalStats(SolrQueryRequest req,
                                         List<ShardResponse> responses)

      Description copied from class: `StatsCache`
      Process shard responses that contain partial local stats. Usually this entails combining per-shard stats for each term.
      Specified by:
        `mergeToGlobalStats` in class `StatsCache`
      Parameters:
        `req` - query request
        `responses` - responses from shards containing local stats for each shard

    - #### returnLocalStats

          public void returnLocalStats(ResponseBuilder rb,
                                       SolrIndexSearcher searcher)

      Description copied from class: `StatsCache`
      Prepare a local (from the local shard) response to a "retrieve stats" shard request.
      Specified by:
        `returnLocalStats` in class `StatsCache`
      Parameters:
        `rb` - response builder
        `searcher` - current local searcher

    - #### receiveGlobalStats

          public void receiveGlobalStats(SolrQueryRequest req)

      Description copied from class: `StatsCache`
      Receive global stats data from the master and update a local cache of stats with this global data. This event occurs either as a separate request, or together with the regular query request, in which case this method is called first, before preparing a `QueryCommand` to be submitted to the local `SolrIndexSearcher`.
      Specified by:
        `receiveGlobalStats` in class `StatsCache`
      Parameters:
        `req` - query request with global stats data

    - #### sendGlobalStats

          public void sendGlobalStats(ResponseBuilder rb,
                                      ShardRequest outgoing)

      Description copied from class: `StatsCache`
      Prepare global stats data to be sent out to shards in this request.
      Specified by:
        `sendGlobalStats` in class `StatsCache`
      Parameters:
        `rb` - response builder
        `outgoing` - shard request to be sent

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.