org.apache.solr.handler.component

## Class StatsComponent

- java.lang.Object
- - org.apache.solr.handler.component.SearchComponent
  - - org.apache.solr.handler.component.StatsComponent

- All Implemented Interfaces:
    SolrInfoMBean, NamedListInitializedPlugin

      public class StatsComponent
      extends SearchComponent

  Stats component calculates simple statistics on numeric field values
  Since:
    solr 1.4

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean

      `SolrInfoMBean.Category`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `COMPONENT_NAME`

    - ### Fields inherited from class org.apache.solr.handler.component.SearchComponent

      `standard_components`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatsComponent()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static NamedList<NamedList<NamedList<?>>>` | `convertToResponse(Map<String,StatsValues> statsValues)` Given a map of `StatsValues` using the appropriate response key, builds up the necessary "stats" data structure for including in the response -- including the esoteric "stats_fields" wrapper.
    `int` | `distributedProcess(ResponseBuilder rb)` Process for a distributed search.
    `void` | `finishStage(ResponseBuilder rb)` Called after all responses have been received for this stage.
    `String` | `getDescription()` Simple one or two line description
    `void` | `handleResponses(ResponseBuilder rb, ShardRequest sreq)` Called after all responses for a single request were received
    `void` | `modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq)` Called after another component adds a request
    `void` | `prepare(ResponseBuilder rb)` Prepare the response.
    `void` | `process(ResponseBuilder rb)` Process the request for this component
    `static NamedList<NamedList<?>>` | `unwrapStats(NamedList<NamedList<NamedList<?>>> stats)` Helper to pull the "stats_fields" out of the extra "stats" wrapper

    - ### Methods inherited from class org.apache.solr.handler.component.SearchComponent

      `getCategory, getDocs, getName, getSource, getStatistics, getVersion, init, setName`

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

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

- - ### Field Detail

    - #### COMPONENT_NAME

          public static final String COMPONENT_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StatsComponent

          public StatsComponent()

  - ### Method Detail

    - #### prepare

          public void prepare(ResponseBuilder rb)
                       throws IOException

      Description copied from class: `SearchComponent`
      Prepare the response. Guaranteed to be called before any SearchComponent `SearchComponent.process(org.apache.solr.handler.component.ResponseBuilder)` method. Called for every incoming request. The place to do initialization that is request dependent.
      Specified by:
        `prepare` in class `SearchComponent`
      Parameters:
        `rb` - The `ResponseBuilder`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### process

          public void process(ResponseBuilder rb)
                       throws IOException

      Description copied from class: `SearchComponent`
      Process the request for this component
      Specified by:
        `process` in class `SearchComponent`
      Parameters:
        `rb` - The `ResponseBuilder`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### distributedProcess

          public int distributedProcess(ResponseBuilder rb)
                                 throws IOException

      Description copied from class: `SearchComponent`
      Process for a distributed search.
      Overrides:
        `distributedProcess` in class `SearchComponent`
      Returns:
        the next stage for this component
      Throws:
        `IOException`

    - #### modifyRequest

          public void modifyRequest(ResponseBuilder rb,
                                    SearchComponent who,
                                    ShardRequest sreq)

      Description copied from class: `SearchComponent`
      Called after another component adds a request
      Overrides:
        `modifyRequest` in class `SearchComponent`

    - #### handleResponses

          public void handleResponses(ResponseBuilder rb,
                                      ShardRequest sreq)

      Description copied from class: `SearchComponent`
      Called after all responses for a single request were received
      Overrides:
        `handleResponses` in class `SearchComponent`

    - #### finishStage

          public void finishStage(ResponseBuilder rb)

      Description copied from class: `SearchComponent`
      Called after all responses have been received for this stage. Useful when different requests are sent to each shard.
      Overrides:
        `finishStage` in class `SearchComponent`

    - #### unwrapStats

          public static NamedList<NamedList<?>> unwrapStats(NamedList<NamedList<NamedList<?>>> stats)

      Helper to pull the "stats_fields" out of the extra "stats" wrapper

    - #### convertToResponse

          public static NamedList<NamedList<NamedList<?>>> convertToResponse(Map<String,StatsValues> statsValues)

      Given a map of `StatsValues` using the appropriate response key, builds up the necessary "stats" data structure for including in the response -- including the esoteric "stats_fields" wrapper.

    - #### getDescription

          public String getDescription()

      Description copied from interface: `SolrInfoMBean`
      Simple one or two line description
      Specified by:
        `getDescription` in interface `SolrInfoMBean`
      Specified by:
        `getDescription` in class `SearchComponent`

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