Class DoubleField
- java.lang.Object
-
- org.apache.solr.analytics.function.field.AnalyticsField
-
- org.apache.solr.analytics.function.field.DoubleField
-
- All Implemented Interfaces:
AnalyticsValue
,AnalyticsValueStream
,ComparableValue
,DoubleValue
,DoubleValue.CastingDoubleValue
,DoubleValueStream
,StringValue
,StringValueStream
public class DoubleField extends AnalyticsField implements DoubleValue.CastingDoubleValue
An analytics wrapper for a single-valuedTrieDoubleField
orDoublePointField
with DocValues enabled.
-
-
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.StringValue
StringValue.AbstractStringValue, StringValue.CastingStringValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.StringValueStream
StringValueStream.AbstractStringValueStream, StringValueStream.CastingStringValueStream
-
-
Field Summary
-
Fields inherited from class org.apache.solr.analytics.function.field.AnalyticsField
fieldName, initialArrayLength
-
-
Constructor Summary
Constructors Constructor Description DoubleField(String fieldName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
collect(int doc)
Collect the value(s) of the wrapped field for the given document, and store the value.void
doSetNextReader(org.apache.lucene.index.LeafReaderContext context)
Set the segment reader contextboolean
exists()
Check whether the current value exists.double
getDouble()
Get the double representation of the current value.Object
getObject()
Get the object representation of the current value.ExpressionComparator<Double>
getObjectComparator(String expression)
Create an entry comparator used to sort the facet-value buckets of a facet.String
getString()
Get the String representation of the current value.void
streamDoubles(DoubleConsumer cons)
Stream the double representations of all current values, if any exist.void
streamObjects(Consumer<Object> cons)
Stream the object representations of all current values, if any exist.void
streamStrings(Consumer<String> cons)
Stream the String representations of all current values, if any exist.-
Methods inherited from class org.apache.solr.analytics.function.field.AnalyticsField
convertToConstant, getExpressionStr, getExpressionType, getName
-
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.AnalyticsValueStream
convertToConstant, getExpressionStr, getExpressionType, getName
-
-
-
-
Constructor Detail
-
DoubleField
public DoubleField(String fieldName)
-
-
Method Detail
-
doSetNextReader
public void doSetNextReader(org.apache.lucene.index.LeafReaderContext context) throws IOException
Description copied from class:AnalyticsField
Set the segment reader context- Specified by:
doSetNextReader
in classAnalyticsField
- Parameters:
context
- segment context- Throws:
IOException
- if an error occurs while loading the leaf reader
-
collect
public void collect(int doc) throws IOException
Description copied from class:AnalyticsField
Collect the value(s) of the wrapped field for the given document, and store the value.- Specified by:
collect
in classAnalyticsField
- Parameters:
doc
- ID of the document to collect- Throws:
IOException
- if an error occurs while reading the document.
-
getDouble
public double getDouble()
Description copied from interface:DoubleValue
Get the double representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()
afterwards returnsTRUE
.- Specified by:
getDouble
in interfaceDoubleValue
- Returns:
- the current value
-
getString
public String getString()
Description copied from interface:StringValue
Get the String representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()
afterwards returnsTRUE
.- Specified by:
getString
in interfaceStringValue
- Returns:
- the current value
-
getObject
public Object getObject()
Description copied from interface:AnalyticsValue
Get the object representation of the current value.- Specified by:
getObject
in interfaceAnalyticsValue
- Returns:
- the current value
-
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
-
streamDoubles
public void streamDoubles(DoubleConsumer cons)
Description copied from interface:DoubleValueStream
Stream the double representations of all current values, if any exist.- Specified by:
streamDoubles
in interfaceDoubleValueStream
- Parameters:
cons
- The consumer to accept the values
-
streamStrings
public void streamStrings(Consumer<String> cons)
Description copied from interface:StringValueStream
Stream the String representations of all current values, if any exist.- Specified by:
streamStrings
in interfaceStringValueStream
- Parameters:
cons
- The consumer to accept the values
-
streamObjects
public void streamObjects(Consumer<Object> cons)
Description copied from interface:AnalyticsValueStream
Stream the object representations of all current values, if any exist.- Specified by:
streamObjects
in interfaceAnalyticsValueStream
- Parameters:
cons
- The consumer to accept the values
-
getObjectComparator
public ExpressionComparator<Double> getObjectComparator(String expression)
Description copied from interface:ComparableValue
Create an entry comparator used to sort the facet-value buckets of a facet.- Specified by:
getObjectComparator
in interfaceComparableValue
- Parameters:
expression
- the name of the expression in the results array- Returns:
- a comparator to sort the buckets with
-
-