Class AnalyticsRequestManager


  • public class AnalyticsRequestManager
    extends Object
    The manager of an entire analytics request.
    • Field Detail

      • analyticsRequest

        public String analyticsRequest
        If the request is distributed, the manager for shard requests.
      • sendShards

        public boolean sendShards
    • Constructor Detail

      • AnalyticsRequestManager

        public AnalyticsRequestManager​(ReductionCollectionManager ungroupedReductionManager,
                                       Collection<AnalyticsExpression> ungroupedExpressions)
        Create an manager with the given ungrouped expressions. This is straightforward in the new style of request, however in the old olap-style requests all groupings' expressions are expected to be ungrouped as well.
        Parameters:
        ungroupedReductionManager - to manage the reduction collection for all ungrouped expressions
        ungroupedExpressions - to compute overall results for
    • Method Detail

      • getUngroupedCollectionManager

        public ReductionCollectionManager getUngroupedCollectionManager()
        Get the collection manager for ungrouped expressions, including grouped expressions if the old request notation is used.
        Returns:
        the collection manager for the ungrouped expressions
      • getUngroupedData

        public ReductionCollectionManager.ReductionDataCollection getUngroupedData()
        Get the collection manager for all ungrouped expressions, including grouped expressions if the old request notation is used.
        Returns:
        the collection manager for the ungrouped expressions
      • getUngroupedExpressions

        public Iterable<AnalyticsExpression> getUngroupedExpressions()
        Return all ungrouped expressions, including grouped expressions if the old request notation is used.
        Returns:
        an Iterable of the ungrouped expressions
      • addUngroupedResults

        public void addUngroupedResults​(Map<String,​Object> response)
        Generate the results of all ungrouped expressions, including grouped expressions if the old request notation is used.
        Parameters:
        response - the response to add the ungrouped results to.
      • getUngroupedResults

        public Map<String,​Object> getUngroupedResults()
        Generate the results of all ungrouped expressions, including grouped expressions if the old request notation is used.
        Returns:
        the map containing the ungrouped results
      • addGrouping

        public void addGrouping​(AnalyticsGroupingManager groupingManager)
        Add a grouping to the request.
        Parameters:
        groupingManager - that manages the grouping
      • importShardData

        public void importShardData​(DataInput input)
                             throws IOException
        Import the shard data for this request from a bit-stream, exported by the exportShardData(java.io.DataOutput) method in the each of the collection's shards.

        First the overall data is imported, then the grouping data is imported.

        Parameters:
        input - The bit-stream to import the shard 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 request through a bit-stream, to be imported by the importShardData(java.io.DataInput) method in the originating shard.

        First the overall data is exported, then the grouping data is exported.

        Parameters:
        output - The bit-stream to output the shard data through
        Throws:
        IOException - if an exception occurs while writing to the DataOutput
      • createOldResponse

        public org.apache.solr.common.util.NamedList<Object> createOldResponse()
        Create the response for a request given in the old olap-style format. The old response returned overall expressions within groupings.
        Returns:
        a NamedList representation of the response
      • createResponse

        public Map<String,​Object> createResponse()
        Create the response for a request.

        NOTE: Analytics requests specified in the old olap-style format have their responses generated by createOldResponse().

        Returns:
        a Map representation of the response
      • setPartialResults

        public void setPartialResults​(boolean b)
      • isPartialResults

        public boolean isPartialResults()