Class AnalyticsGroupingManager


  • public class AnalyticsGroupingManager
    extends Object
    The manager for faceted analytics. This class manages one grouping of facets and expressions to compute over those facets.

    This class will only manage generating faceted results, not overall results.

    • Method Detail

      • getStreamingFacets

        public boolean getStreamingFacets​(Consumer<StreamingFacet> cons)
        Get the StreamingFacets (e.g. ValueFacet and PivotFacet) contained within this grouping, returning them through the given consumer.
        Parameters:
        cons - where the streaming facets are passed to
        Returns:
        whether the grouping contains streaming facets
      • addFacet

        public void addFacet​(AnalyticsFacet facet)
        Add a facet to the grouping. All expressions in this grouping will be computed over the facet.
        Parameters:
        facet - to compute expressions over
      • importShardData

        public void importShardData​(DataInput input)
                             throws IOException
        Import the shard data for this grouping from a bit-stream, exported by the exportShardData(java.io.DataOutput) method in the each of the collection's shards.
        Parameters:
        input - The bit-stream to import the grouping data from
        Throws:
        IOException - if an exception occurs while reading from the DataInput
      • exportShardData

        public void exportShardData​(DataOutput output)
                             throws IOException
        Export the shard data for this grouping through a bit-stream, to be imported by the importShardData(java.io.DataInput) method in the originating shard.
        Parameters:
        output - The bit-stream to output the grouping data through
        Throws:
        IOException - if an exception occurs while writing to the DataOutput
      • createResponse

        public Map<String,​Object> createResponse()
        Create the response for this grouping, a mapping from each of it's facets' names to the facet's response.
        Returns:
        the named list representation of the response
      • createOldResponse

        public NamedList<Object> createOldResponse​(Map<String,​Object> overallResults)
        Create the response for this grouping, but in the old style of response. This response has a bucket for the following if they are contained in the grouping: FieldFacets, RangeFacets and QueryFacets. Each facet's name and response are put into the bucket corresponding to its type.

        Since groupings in the old notation must also return overall results, the overall results are passed in and the values are used to populate the grouping response.

        Parameters:
        overallResults - of the expressions to add to the grouping response
        Returns:
        the named list representation of the response
      • getName

        public String getName()
        Get the name of the grouping.
        Returns:
        the grouping name