Class UniqueFunction
- java.lang.Object
-
- org.apache.solr.analytics.value.LongValue.AbstractLongValue
-
- org.apache.solr.analytics.function.reduction.UniqueFunction
-
- All Implemented Interfaces:
ReductionFunction
,AnalyticsValue
,AnalyticsValueStream
,ComparableValue
,DoubleValue
,DoubleValueStream
,LongValue
,LongValue.CastingLongValue
,LongValueStream
,StringValue
,StringValueStream
public class UniqueFunction extends LongValue.AbstractLongValue implements ReductionFunction
A reduction function which returns the number of unique values of the given expression.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.AnalyticsValue
AnalyticsValue.AbstractAnalyticsValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.AnalyticsValueStream
AnalyticsValueStream.AbstractAnalyticsValueStream, AnalyticsValueStream.ExpressionType
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.DoubleValue
DoubleValue.AbstractDoubleValue, DoubleValue.CastingDoubleValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.DoubleValueStream
DoubleValueStream.AbstractDoubleValueStream, DoubleValueStream.CastingDoubleValueStream
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.LongValue
LongValue.AbstractLongValue, LongValue.CastingLongValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.LongValueStream
LongValueStream.AbstractLongValueStream, LongValueStream.CastingLongValueStream
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.StringValue
StringValue.AbstractStringValue, StringValue.CastingStringValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.StringValueStream
StringValueStream.AbstractStringValueStream, StringValueStream.CastingStringValueStream
-
-
Field Summary
Fields Modifier and Type Field Description static ExpressionFactory.CreatorFunction
creatorFunction
static String
name
-
Constructor Summary
Constructors Constructor Description UniqueFunction(AnalyticsValueStream param, UniqueCollector<?> collector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
exists()
Check whether the current value exists.String
getExpressionStr()
Get the expression string of the analytics value stream.AnalyticsValueStream.ExpressionType
getExpressionType()
Get the type of the expression that this class represents.long
getLong()
Get the long representation of the current value.String
getName()
Get the name of function or value.void
synchronizeDataCollectors(UnaryOperator<ReductionDataCollector<?>> sync)
Syncs the data collectors with shared versions across the entire Analytics Request so that as little data as possible is sent across shards.-
Methods inherited from class org.apache.solr.analytics.value.LongValue.AbstractLongValue
convertToConstant, getDouble, getObject, getObjectComparator, getString, streamDoubles, streamLongs, streamObjects, streamStrings
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.analytics.value.AnalyticsValue
getObject
-
Methods inherited from interface org.apache.solr.analytics.value.AnalyticsValueStream
convertToConstant, streamObjects
-
-
-
-
Field Detail
-
name
public static final String name
- See Also:
- Constant Field Values
-
creatorFunction
public static final ExpressionFactory.CreatorFunction creatorFunction
-
-
Constructor Detail
-
UniqueFunction
public UniqueFunction(AnalyticsValueStream param, UniqueCollector<?> collector)
-
-
Method Detail
-
getLong
public long getLong()
Description copied from interface:LongValue
Get the long representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()
afterwards returnsTRUE
.
-
exists
public boolean exists()
Description copied from interface:AnalyticsValue
Check whether the current value exists.
NOTE: The result of this method is only guaranteed after anyget<Type>()
method is called.- Specified by:
exists
in interfaceAnalyticsValue
- Returns:
- whether the current value exists
-
synchronizeDataCollectors
public void synchronizeDataCollectors(UnaryOperator<ReductionDataCollector<?>> sync)
Description copied from interface:ReductionFunction
Syncs the data collectors with shared versions across the entire Analytics Request so that as little data as possible is sent across shards.- Specified by:
synchronizeDataCollectors
in interfaceReductionFunction
- Parameters:
sync
- a function that takes in aReductionDataCollector
and returns a shared version
-
getName
public String getName()
Description copied from interface:AnalyticsValueStream
Get the name of function or value.- Specified by:
getName
in interfaceAnalyticsValueStream
- Returns:
- the name of function/value
-
getExpressionStr
public String getExpressionStr()
Description copied from interface:AnalyticsValueStream
Get the expression string of the analytics value stream. Must be unique to the expression. If passed toExpressionFactory.createExpression(String)
, the exact same expression should be created.- Specified by:
getExpressionStr
in interfaceAnalyticsValueStream
- Returns:
- the name of function/value
-
getExpressionType
public AnalyticsValueStream.ExpressionType getExpressionType()
Description copied from interface:AnalyticsValueStream
Get the type of the expression that this class represents.- Specified by:
getExpressionType
in interfaceAnalyticsValueStream
- Returns:
- the expression type
-
-