Package org.apache.solr.analytics
Class AnalyticsGroupingManager
- java.lang.Object
-
- org.apache.solr.analytics.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.
-
-
Constructor Summary
Constructors Constructor Description AnalyticsGroupingManager(String name, ReductionCollectionManager reductionCollectionManager, Collection<AnalyticsExpression> topLevelExpressions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFacet(AnalyticsFacet facet)
Add a facet to the grouping.NamedList<Object>
createOldResponse(Map<String,Object> overallResults)
Create the response for this grouping, but in the old style of response.Map<String,Object>
createResponse()
Create the response for this grouping, a mapping from each of it's facets' names to the facet's response.void
exportShardData(DataOutput output)
Export the shard data for this grouping through a bit-stream, to be imported by theimportShardData(java.io.DataInput)
method in the originating shard.void
getFacetExecuters(Filter filter, SolrQueryRequest queryRequest, Consumer<AbstractSolrQueryFacet.FacetValueQueryExecuter> cons)
Create theAbstractSolrQueryFacet.FacetValueQueryExecuter
s for allAbstractSolrQueryFacet
s (e.g.String
getName()
Get the name of the grouping.ReductionCollectionManager
getReductionManager()
Get theReductionCollectionManager
that manages the collection of reduction data for the expressions contained within this grouping.boolean
getStreamingFacets(Consumer<StreamingFacet> cons)
Get theStreamingFacet
s (e.g.void
importShardData(DataInput input)
Import the shard data for this grouping from a bit-stream, exported by theexportShardData(java.io.DataOutput)
method in the each of the collection's shards.
-
-
-
Constructor Detail
-
AnalyticsGroupingManager
public AnalyticsGroupingManager(String name, ReductionCollectionManager reductionCollectionManager, Collection<AnalyticsExpression> topLevelExpressions)
-
-
Method Detail
-
getStreamingFacets
public boolean getStreamingFacets(Consumer<StreamingFacet> cons)
Get theStreamingFacet
s (e.g.ValueFacet
andPivotFacet
) 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
-
getFacetExecuters
public void getFacetExecuters(Filter filter, SolrQueryRequest queryRequest, Consumer<AbstractSolrQueryFacet.FacetValueQueryExecuter> cons)
Create theAbstractSolrQueryFacet.FacetValueQueryExecuter
s for allAbstractSolrQueryFacet
s (e.g.QueryFacet
andRangeFacet
) contained within this grouping. The executers are returned through the given consumer.One
AbstractSolrQueryFacet.FacetValueQueryExecuter
is created for each facet value to be returned for a facet. Since everyAbstractSolrQueryFacet
has discrete and user-defined facet values, unlikeStreamingFacet
s, a discrete number ofAbstractSolrQueryFacet.FacetValueQueryExecuter
s are created and returned.- Parameters:
filter
- representing the overall Solr Query of the request, will be combined with the facet value queriesqueryRequest
- from the overall search requestcons
- where the executers are passed to
-
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 theexportShardData(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 theDataInput
-
exportShardData
public void exportShardData(DataOutput output) throws IOException
Export the shard data for this grouping through a bit-stream, to be imported by theimportShardData(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 theDataOutput
-
getReductionManager
public ReductionCollectionManager getReductionManager()
Get theReductionCollectionManager
that manages the collection of reduction data for the expressions contained within this grouping.- Returns:
- the grouping's reduction manager
-
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
-
-