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.SortableEntry(String name, String value) Constructs an entry from an already encoded maximum.SortableEntry(String name, String value, String minimum) Constructs an entry from encoded extrema; a missing minimum retains the maximum-only representation. -
Method Summary
Modifier and TypeMethodDescriptionintstatic StringformatSortable(Object value) Formats the given object into a sortable string depending on its type.merge(SortableEntry other) Combines entries at one normalized path without changing the maximum's original escaped path.Returns the minimum, retaining maximum semantics for legacy entries.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
-
SortableEntry
-
SortableEntry
-
-
Method Details
-
minimumOrValue
Returns the minimum, retaining maximum semantics for legacy entries. -
merge
Combines entries at one normalized path without changing the maximum's original escaped path. -
formatSortable
-
compareTo
- Specified by:
compareToin interfaceComparable<SortableEntry>
-
toSortableString
-