Class DateField
- java.lang.Object
-
- org.apache.solr.analytics.function.field.AnalyticsField
-
- org.apache.solr.analytics.function.field.DateField
-
- All Implemented Interfaces:
AnalyticsValue,AnalyticsValueStream,ComparableValue,DateValue,DateValue.CastingDateValue,DateValueStream,LongValue,LongValueStream,StringValue,StringValueStream
public class DateField extends AnalyticsField implements DateValue.CastingDateValue
An analytics wrapper for a single-valuedTrieDateFieldorDatePointFieldwith 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.DateValue
DateValue.AbstractDateValue, DateValue.CastingDateValue
-
Nested classes/interfaces inherited from interface org.apache.solr.analytics.value.DateValueStream
DateValueStream.AbstractDateValueStream, DateValueStream.CastingDateValueStream
-
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 inherited from class org.apache.solr.analytics.function.field.AnalyticsField
fieldName, initialArrayLength
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollect(int doc)Collect the value(s) of the wrapped field for the given document, and store the value.voiddoSetNextReader(org.apache.lucene.index.LeafReaderContext context)Set the segment reader contextbooleanexists()Check whether the current value exists.DategetDate()Get the date representation of the current value.longgetLong()Get the long representation of the current value.ObjectgetObject()Get the object representation of the current value.ExpressionComparator<Date>getObjectComparator(String expression)Create an entry comparator used to sort the facet-value buckets of a facet.StringgetString()Get the String representation of the current value.voidstreamDates(Consumer<Date> cons)Stream the date representations of all current values, if any exist.voidstreamLongs(LongConsumer cons)Stream the long representations of all current values, if any exist.voidstreamObjects(Consumer<Object> cons)Stream the object representations of all current values, if any exist.voidstreamStrings(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
-
DateField
public DateField(String fieldName)
-
-
Method Detail
-
doSetNextReader
public void doSetNextReader(org.apache.lucene.index.LeafReaderContext context) throws IOExceptionDescription copied from class:AnalyticsFieldSet the segment reader context- Specified by:
doSetNextReaderin classAnalyticsField- Parameters:
context- segment context- Throws:
IOException- if an error occurs while loading the leaf reader
-
collect
public void collect(int doc) throws IOExceptionDescription copied from class:AnalyticsFieldCollect the value(s) of the wrapped field for the given document, and store the value.- Specified by:
collectin classAnalyticsField- Parameters:
doc- ID of the document to collect- Throws:
IOException- if an error occurs while reading the document.
-
getLong
public long getLong()
Description copied from interface:LongValueGet the long representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()afterwards returnsTRUE.
-
getDate
public Date getDate()
Description copied from interface:DateValueGet the date representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()afterwards returnsTRUE.
-
getString
public String getString()
Description copied from interface:StringValueGet the String representation of the current value.NOTE: The value returned is not valid unless calling
AnalyticsValue.exists()afterwards returnsTRUE.- Specified by:
getStringin interfaceStringValue- Returns:
- the current value
-
getObject
public Object getObject()
Description copied from interface:AnalyticsValueGet the object representation of the current value.- Specified by:
getObjectin interfaceAnalyticsValue- Returns:
- the current value
-
exists
public boolean exists()
Description copied from interface:AnalyticsValueCheck whether the current value exists.
NOTE: The result of this method is only guaranteed after anyget<Type>()method is called.- Specified by:
existsin interfaceAnalyticsValue- Returns:
- whether the current value exists
-
streamLongs
public void streamLongs(LongConsumer cons)
Description copied from interface:LongValueStreamStream the long representations of all current values, if any exist.- Specified by:
streamLongsin interfaceLongValueStream- Parameters:
cons- The consumer to accept the values
-
streamDates
public void streamDates(Consumer<Date> cons)
Description copied from interface:DateValueStreamStream the date representations of all current values, if any exist.- Specified by:
streamDatesin interfaceDateValueStream- Parameters:
cons- The consumer to accept the values
-
streamStrings
public void streamStrings(Consumer<String> cons)
Description copied from interface:StringValueStreamStream the String representations of all current values, if any exist.- Specified by:
streamStringsin interfaceStringValueStream- Parameters:
cons- The consumer to accept the values
-
streamObjects
public void streamObjects(Consumer<Object> cons)
Description copied from interface:AnalyticsValueStreamStream the object representations of all current values, if any exist.- Specified by:
streamObjectsin interfaceAnalyticsValueStream- Parameters:
cons- The consumer to accept the values
-
getObjectComparator
public ExpressionComparator<Date> getObjectComparator(String expression)
Description copied from interface:ComparableValueCreate an entry comparator used to sort the facet-value buckets of a facet.- Specified by:
getObjectComparatorin interfaceComparableValue- Parameters:
expression- the name of the expression in the results array- Returns:
- a comparator to sort the buckets with
-
-