Class SortableEntry
java.lang.Object
io.fluxzero.common.api.search.SortableEntry
- All Implemented Interfaces:
Comparable<SortableEntry>
Represents a sortable entry in a
Document for use in search
operations.
SortableEntry values are primarily used to support efficient sorting and range filtering in the document store
(e.g., numeric or timestamp-based queries). Each entry consists of a name (field path) and a pre-normalized,
lexicographically sortable value as a String.
Values are formatted using a normalization strategy depending on their type:
- Numbers: Encoded into padded, base-10 fixed-width strings for fast and correct range comparisons
- Timestamps: Formatted using
SearchUtils.ISO_FULL - Other values: Normalized to lowercase using
SearchUtils.normalize(String)
Example Use Cases
- Sorting search results by timestamp or numeric score
- Enabling fast
BetweenConstraintevaluation - Filtering or grouping based on normalized values
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<SortableEntry> Comparator used to lexicographically compare entries based onnameandvalue. -
Constructor Summary
ConstructorsConstructorDescriptionSortableEntry(String name, Object value) Constructs a newSortableEntryby formatting the given object into a normalized, sortable string. -
Method Summary
Modifier and TypeMethodDescriptionintstatic StringformatSortable(Object value) Formats the given object into a sortable string depending on its type.static StringtoSortableString(Number number) Converts aNumberto a lexicographically sortable zero-padded string.
-
Field Details
-
comparator
Comparator used to lexicographically compare entries based onnameandvalue.
-
-
Constructor Details
-
SortableEntry
-
-
Method Details
-
formatSortable
-
compareTo
- Specified by:
compareToin interfaceComparable<SortableEntry>
-
toSortableString
-