Class LongColumn
Column that provides long values. Used for NUMERIC and SORTED_NUMERIC doc values and for stored
numeric fields.
Iteration is performed via cursors. tuples() is always available and yields
(docID, longValue) pairs. values() is a bulk cursor over consecutive doc-ids; it must
be overridden when Column.density() is DENSE and is only consulted
in that case.
numericKind() marks how the long bits should be interpreted. Defaults to LONG; pass INT (low 32 bits, sign-extended), FLOAT (low 32 bits encoded via NumericUtils.floatToSortableInt(float)), or DOUBLE
(full 64 bits encoded via NumericUtils.doubleToSortableLong(double)) to
the constructor to select another interpretation. Callers are responsible for producing the
sortable encoding; doc values writes the long unchanged, points consumes it as sortable bytes,
and stored fields round-trips it back to float/double via NumericUtils.sortableIntToFloat(int) / NumericUtils.sortableLongToDouble(long). The numeric kind drives the default
storedType().
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe numeric interpretation of the column's long values.Nested classes/interfaces inherited from class org.apache.lucene.document.column.Column
Column.Density -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLongColumn(String name, IndexableFieldType fieldType, Column.Density density) Creates a LongColumn withLongColumn.NumericKind.LONG.protectedLongColumn(String name, IndexableFieldType fieldType, Column.Density density, LongColumn.NumericKind numericKind) Creates a LongColumn with the given numeric interpretation. -
Method Summary
Modifier and TypeMethodDescriptionfinal LongColumn.NumericKindThe numeric interpretation of the column's long values.final StoredValue.TypeThe stored-field variant emitted for this column.abstract LongTupleCursortuples()Returns a fresh tuple cursor starting at the beginning of the batch.values()Returns a fresh values cursor iterating dense long values for doc-ids[0, numDocs).
-
Constructor Details
-
LongColumn
Creates a LongColumn withLongColumn.NumericKind.LONG. -
LongColumn
protected LongColumn(String name, IndexableFieldType fieldType, Column.Density density, LongColumn.NumericKind numericKind) Creates a LongColumn with the given numeric interpretation.
-
-
Method Details
-
tuples
Returns a fresh tuple cursor starting at the beginning of the batch. -
values
Returns a fresh values cursor iterating dense long values for doc-ids[0, numDocs). Must be overridden whenColumn.density()isDENSE; the default implementation throwsUnsupportedOperationExceptionand is never called forSPARSEcolumns. -
numericKind
The numeric interpretation of the column's long values. -
storedType
The stored-field variant emitted for this column. The default derives fromnumericKind()—INT→INTEGER,LONG→LONG,FLOAT→FLOAT,DOUBLE→DOUBLE— so a caller that wants the natural numeric variant does not need to override this method. Only numericStoredValue.Typevalues are permitted; non-numeric stored data should use aBinaryColumn.
-