Package org.apache.solr.analytics
Class AnalyticsRequestManager
- java.lang.Object
-
- org.apache.solr.analytics.AnalyticsRequestManager
-
public class AnalyticsRequestManager extends Object
The manager of an entire analytics request.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnalyticsRequestManager.StreamingInfoClass to encapsulate all necessary data for collectingStreamingFacets.
-
Field Summary
Fields Modifier and Type Field Description StringanalyticsRequestIf the request is distributed, the manager for shard requests.booleansendShardsAnalyticsShardRequestManagershardStream
-
Constructor Summary
Constructors Constructor Description AnalyticsRequestManager(ReductionCollectionManager ungroupedReductionManager, Collection<AnalyticsExpression> ungroupedExpressions)Create an manager with the given ungrouped expressions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGrouping(AnalyticsGroupingManager groupingManager)Add a grouping to the request.voidaddUngroupedResults(Map<String,Object> response)Generate the results of all ungrouped expressions, including grouped expressions if the old request notation is used.org.apache.solr.common.util.NamedList<Object>createOldResponse()Create the response for a request given in the old olap-style format.Map<String,Object>createResponse()Create the response for a request.voidexportShardData(DataOutput output)Export the shard data for this request through a bit-stream, to be imported by theimportShardData(java.io.DataInput)method in the originating shard.Iterable<AbstractSolrQueryFacet.FacetValueQueryExecuter>getFacetExecuters(org.apache.lucene.search.Query filter, SolrQueryRequest queryRequest)Create theAbstractSolrQueryFacet.FacetValueQueryExecuters for allAbstractSolrQueryFacets contained in the request.AnalyticsRequestManager.StreamingInfogetStreamingFacetInfo()Consolidate the information of allStreamingFacets contained within the request, since they need to be collected along with the overall results during the streaming phase of theAnalyticsDriver.ReductionCollectionManagergetUngroupedCollectionManager()Get the collection manager for ungrouped expressions, including grouped expressions if the old request notation is used.ReductionCollectionManager.ReductionDataCollectiongetUngroupedData()Get the collection manager for all ungrouped expressions, including grouped expressions if the old request notation is used.Iterable<AnalyticsExpression>getUngroupedExpressions()Return all ungrouped expressions, including grouped expressions if the old request notation is used.Map<String,Object>getUngroupedResults()Generate the results of all ungrouped expressions, including grouped expressions if the old request notation is used.voidimportShardData(DataInput input)Import the shard data for this request from a bit-stream, exported by theexportShardData(java.io.DataOutput)method in the each of the collection's shards.booleanisPartialResults()voidsetPartialResults(boolean b)
-
-
-
Field Detail
-
analyticsRequest
public String analyticsRequest
If the request is distributed, the manager for shard requests.
-
shardStream
public AnalyticsShardRequestManager shardStream
-
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 expressionsungroupedExpressions- 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
Iterableof 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 theexportShardData(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 theDataInput
-
exportShardData
public void exportShardData(DataOutput output) throws IOException
Export the shard data for this request through a bit-stream, to be imported by theimportShardData(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 theDataOutput
-
getStreamingFacetInfo
public AnalyticsRequestManager.StreamingInfo getStreamingFacetInfo()
Consolidate the information of allStreamingFacets contained within the request, since they need to be collected along with the overall results during the streaming phase of theAnalyticsDriver.- Returns:
- the info for all
StreamingFacets
-
getFacetExecuters
public Iterable<AbstractSolrQueryFacet.FacetValueQueryExecuter> getFacetExecuters(org.apache.lucene.search.Query filter, SolrQueryRequest queryRequest)
Create theAbstractSolrQueryFacet.FacetValueQueryExecuters for allAbstractSolrQueryFacets contained in the request.- Parameters:
filter- representing the overall search queryqueryRequest- of the overall search query- Returns:
- an
Iterableof executers
-
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
NamedListrepresentation 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
Maprepresentation of the response
-
setPartialResults
public void setPartialResults(boolean b)
-
isPartialResults
public boolean isPartialResults()
-
-