Class CountCollector
- java.lang.Object
-
- org.apache.solr.analytics.function.reduction.data.ReductionDataCollector<CountCollector.CountData>
-
- org.apache.solr.analytics.function.reduction.data.CountCollector
-
- Direct Known Subclasses:
CountCollector.ExpressionCountCollector
,CountCollector.TotalCountCollector
public abstract class CountCollector extends ReductionDataCollector<CountCollector.CountData>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CountCollector.CountData
static class
CountCollector.ExpressionCountCollector
Represents acount(expr)
expression.static class
CountCollector.TotalCountCollector
Represents acount()
expression.
-
Field Summary
Fields Modifier and Type Field Description static String
name
-
Fields inherited from class org.apache.solr.analytics.function.reduction.data.ReductionDataCollector
collectionTargets, ioData, lastingTargets
-
-
Constructor Summary
Constructors Constructor Description CountCollector(String exprStr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
count()
The number of Solr Documents for which the given analytics expression exists.long
docCount()
The number of Solr Documents used in this reduction.String
getExpressionStr()
The unique expression string of the reduction data collector, given all inputs and parameters.String
getName()
Get the name of the reduction data collector.CountCollector.CountData
newData()
A clean slate to start a new reduction.void
setData(ReductionData data)
Finalize the reduction with the collected data stored in the parameter.void
setMergedData(ReductionData data)
Finalize the reduction with the merged data stored in the parameter.void
submitReservations(Consumer<ReductionDataReservation<?,?>> consumer)
Submits the data reservations needed for this data collector.-
Methods inherited from class org.apache.solr.analytics.function.reduction.data.ReductionDataCollector
addCollectTarget, addLastingCollectTarget, apply, clearLastingCollectTargets, collect, collectAndApply, dataIO, newDataIO, newDataTarget
-
-
-
-
Field Detail
-
name
public static final String name
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CountCollector
public CountCollector(String exprStr)
-
-
Method Detail
-
count
public long count()
The number of Solr Documents for which the given analytics expression exists.- Returns:
- the count
-
docCount
public long docCount()
The number of Solr Documents used in this reduction.- Returns:
- the number of documents
-
newData
public CountCollector.CountData newData()
Description copied from class:ReductionDataCollector
A clean slate to start a new reduction.- Specified by:
newData
in classReductionDataCollector<CountCollector.CountData>
- Returns:
- the new reduction data
-
submitReservations
public void submitReservations(Consumer<ReductionDataReservation<?,?>> consumer)
Description copied from class:ReductionDataCollector
Submits the data reservations needed for this data collector.- Specified by:
submitReservations
in classReductionDataCollector<CountCollector.CountData>
- Parameters:
consumer
- the consumer which the reservations are submitted to
-
setMergedData
public void setMergedData(ReductionData data)
Description copied from class:ReductionDataCollector
Finalize the reduction with the merged data stored in the parameter. Once the reduction is finalized, theReductionFunction
s that use this data collector act like regularAnalyticsValue
classes that can be accessed through theirget<value-type>
methods. (FOR CLOUD)- Specified by:
setMergedData
in classReductionDataCollector<CountCollector.CountData>
- Parameters:
data
- the merged data to compute a reduction for
-
setData
public void setData(ReductionData data)
Description copied from class:ReductionDataCollector
Finalize the reduction with the collected data stored in the parameter. Once the reduction is finalized, theReductionFunction
s that use this data collector act like regularAnalyticsValue
classes that can be accessed through theirget<value-type>
methods. (FOR SINGLE-SHARD)- Specified by:
setData
in classReductionDataCollector<CountCollector.CountData>
- Parameters:
data
- the collected data to compute a reduction for
-
getName
public String getName()
Description copied from class:ReductionDataCollector
Get the name of the reduction data collector. This is the same across all instances of the data collector.- Specified by:
getName
in classReductionDataCollector<CountCollector.CountData>
- Returns:
- the name
-
getExpressionStr
public String getExpressionStr()
Description copied from class:ReductionDataCollector
The unique expression string of the reduction data collector, given all inputs and parameters. Used duringReductionDataCollector
syncing. Since the string should be unique, only one of expression is kept.- Specified by:
getExpressionStr
in classReductionDataCollector<CountCollector.CountData>
- Returns:
- the expression string
-
-