Package org.apache.solr.analytics.facet
Class PivotNode<T>
- java.lang.Object
-
- org.apache.solr.analytics.facet.AnalyticsFacet
-
- org.apache.solr.analytics.facet.SortableFacet
-
- org.apache.solr.analytics.facet.PivotNode<T>
-
- Direct Known Subclasses:
PivotNode.PivotBranch
,PivotNode.PivotLeaf
public abstract class PivotNode<T> extends SortableFacet implements Consumer<String>
Representation of one layer of a Pivot Facet. A PivotFacet node is individually sortable, and is collected during the streaming phase of theAnalyticsDriver
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PivotNode.PivotBranch<T>
A pivot node that has pivot children.static class
PivotNode.PivotLeaf
A pivot node that has no pivot children.-
Nested classes/interfaces inherited from class org.apache.solr.analytics.facet.SortableFacet
SortableFacet.FacetBucket, SortableFacet.FacetSortSpecification
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,T>
currentPivot
-
Fields inherited from class org.apache.solr.analytics.facet.SortableFacet
sort
-
Fields inherited from class org.apache.solr.analytics.facet.AnalyticsFacet
collectionManager, expressionCalculator, name, reductionData
-
-
Constructor Summary
Constructors Constructor Description PivotNode(String name, StringValueStream expression)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addFacetValueCollectionTargets(Map<String,T> pivot)
Determine which facet values match the current document.void
exportPivot(DataOutput output, Map<String,T> pivot)
Export the shard data through a bit-stream for the given pivot, to be imported by theimportPivot(java.io.DataInput, java.util.Map<java.lang.String, T>)
method in the originating shard.protected abstract void
exportPivotValue(DataOutput output, T pivotData)
Export the given pivot data, containingReductionData
and pivot children if they exist.abstract Iterable<Map<String,Object>>
getPivotedResponse(Map<String,T> pivot)
Create the response of the facet to be returned in the overall analytics response.void
importPivot(DataInput input, Map<String,T> pivot)
Import the shard data from a bit-stream for the given pivot, exported by theexportPivot(java.io.DataOutput, java.util.Map<java.lang.String, T>)
method in the each of the collection's shards.protected abstract void
importPivotValue(DataInput input, String pivotValue)
Import the next pivot value's set ofReductionData
and children'sReductionData
if they exist.-
Methods inherited from class org.apache.solr.analytics.facet.SortableFacet
applyOptions, createOldResponse, createResponse, getSort, setSort
-
Methods inherited from class org.apache.solr.analytics.facet.AnalyticsFacet
exportFacetValue, exportShardData, getName, importFacetValue, importShardData, setExpressionCalculator, setReductionCollectionManager
-
-
-
-
Constructor Detail
-
PivotNode
public PivotNode(String name, StringValueStream expression)
-
-
Method Detail
-
addFacetValueCollectionTargets
public void addFacetValueCollectionTargets(Map<String,T> pivot)
Determine which facet values match the current document. Add theReductionCollectionManager.ReductionDataCollection
s of the relevant facet values to the targets of the streamingReductionCollectionManager
so that they are updated with the current document's data.
-
importPivot
public void importPivot(DataInput input, Map<String,T> pivot) throws IOException
Import the shard data from a bit-stream for the given pivot, exported by theexportPivot(java.io.DataOutput, java.util.Map<java.lang.String, T>)
method in the each of the collection's shards.- Parameters:
input
- The bit-stream to import the data frompivot
- the values for this pivot node and the pivot children (if they exist)- Throws:
IOException
- if an exception occurs while reading from theDataInput
-
importPivotValue
protected abstract void importPivotValue(DataInput input, String pivotValue) throws IOException
Import the next pivot value's set ofReductionData
and children'sReductionData
if they exist.- Parameters:
input
- the bit-stream to import the reduction data frompivotValue
- the next pivot value- Throws:
IOException
- if an exception occurs while reading from the input
-
exportPivot
public void exportPivot(DataOutput output, Map<String,T> pivot) throws IOException
Export the shard data through a bit-stream for the given pivot, to be imported by theimportPivot(java.io.DataInput, java.util.Map<java.lang.String, T>)
method in the originating shard.- Parameters:
output
- The bit-stream to output the data throughpivot
- the values for this pivot node and the pivot children (if they exist)- Throws:
IOException
- if an exception occurs while writing to theDataOutput
-
exportPivotValue
protected abstract void exportPivotValue(DataOutput output, T pivotData) throws IOException
Export the given pivot data, containingReductionData
and pivot children if they exist.- Parameters:
output
- the bit-stream to output the reduction data topivotData
- the next pivot value data- Throws:
IOException
- if an exception occurs while reading from the input
-
-