org.apache.solr.analytics.accumulator

## Class BasicAccumulator

- java.lang.Object
- - org.apache.lucene.search.SimpleCollector
  - - org.apache.solr.analytics.accumulator.ValueAccumulator
    - - org.apache.solr.analytics.accumulator.BasicAccumulator

- All Implemented Interfaces:
    Collector, LeafCollector
  Direct Known Subclasses:
    FacetingAccumulator

      public class BasicAccumulator
      extends ValueAccumulator

  A `BasicAccumulator` manages the ValueCounters and Expressions without regard to Facets.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LeafReaderContext` | `context`
    `protected DocSet` | `docs`
    `protected String[]` | `expressionNames`
    `protected Expression[]` | `expressions`
    `protected String[]` | `expressionStrings`
    `protected Set<String>` | `hiddenExpressions`
    `protected AnalyticsRequest` | `request`
    `protected SolrIndexSearcher` | `searcher`
    `protected com.google.common.base.Supplier<StatsCollector[]>` | `statsCollectorArraySupplier`
    `protected StatsCollector[]` | `statsCollectors`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicAccumulator(SolrIndexSearcher searcher, DocSet docs, AnalyticsRequest request)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collect(int doc)` Passes the documents on to the `StatsCollector`s to be collected.
    `void` | `compute()` Finalizes the statistics within each StatsCollector.
    `static BasicAccumulator` | `create(SolrIndexSearcher searcher, DocSet docs, AnalyticsRequest request)`
    `protected void` | `doSetNextReader(LeafReaderContext context)`
    `NamedList<?>` | `export()`
    `long` | `getNumQueries()` Used for JMX stats collecting.
    `long` | `getNumStatsCollectors()` Used for JMX stats collecting.
    `String` | `getResult(String expressionName)` Returns the value of an expression to use in a field or query facet.
    `Expression[]` | `makeExpressions(StatsCollector[] statsCollectors)` Builds an array of Expressions with the given list of counters
    `boolean` | `needsScores()`

    - ### Methods inherited from class org.apache.solr.analytics.accumulator.ValueAccumulator

      `postProcess`

    - ### Methods inherited from class org.apache.lucene.search.SimpleCollector

      `getLeafCollector, setScorer`

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

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

- - ### Field Detail

    - #### searcher

          protected final SolrIndexSearcher searcher

    - #### request

          protected final AnalyticsRequest request

    - #### docs

          protected final DocSet docs

    - #### statsCollectorArraySupplier

          protected final com.google.common.base.Supplier<StatsCollector[]> statsCollectorArraySupplier

    - #### statsCollectors

          protected final StatsCollector[] statsCollectors

    - #### expressions

          protected final Expression[] expressions

    - #### expressionNames

          protected final String[] expressionNames

    - #### expressionStrings

          protected final String[] expressionStrings

    - #### hiddenExpressions

          protected final Set<String> hiddenExpressions

    - #### context

          protected LeafReaderContext context

  - ### Constructor Detail

    - #### BasicAccumulator

          public BasicAccumulator(SolrIndexSearcher searcher,
                                  DocSet docs,
                                  AnalyticsRequest request)
                           throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### doSetNextReader

          protected void doSetNextReader(LeafReaderContext context)
                                  throws IOException

      Overrides:
        `doSetNextReader` in class `SimpleCollector`
      Throws:
        `IOException`

    - #### create

          public static BasicAccumulator create(SolrIndexSearcher searcher,
                                                DocSet docs,
                                                AnalyticsRequest request)
                                         throws IOException

      Throws:
        `IOException`

    - #### collect

          public void collect(int doc)
                       throws IOException

      Passes the documents on to the `StatsCollector`s to be collected.
      Specified by:
        `collect` in interface `LeafCollector`
      Specified by:
        `collect` in class `SimpleCollector`
      Parameters:
        `doc` - Document to collect from
      Throws:
        `IOException`

    - #### compute

          public void compute()

      Description copied from class: `ValueAccumulator`
      Finalizes the statistics within each StatsCollector. Must be called before `export()`.
      Specified by:
        `compute` in class `ValueAccumulator`

    - #### export

          public NamedList<?> export()

      Specified by:
        `export` in class `ValueAccumulator`

    - #### makeExpressions

          public Expression[] makeExpressions(StatsCollector[] statsCollectors)

      Builds an array of Expressions with the given list of counters
      Parameters:
        `statsCollectors` - the stats collectors
      Returns:
        The array of Expressions

    - #### getResult

          public String getResult(String expressionName)

      Returns the value of an expression to use in a field or query facet.
      Parameters:
        `expressionName` - the name of the expression
      Returns:
        String String representation of pivot value

    - #### getNumStatsCollectors

          public long getNumStatsCollectors()

      Used for JMX stats collecting. Counts the number of stats requests
      Returns:
        number of unique stats collectors

    - #### getNumQueries

          public long getNumQueries()

      Used for JMX stats collecting. Counts the number of queries in all query facets
      Returns:
        number of queries requested in all query facets.

    - #### needsScores

          public boolean needsScores()

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