Function tantivy_columnar::column_values::monotonic_map_column
source · pub fn monotonic_map_column<C, T, Input, Output>(
from_column: C,
monotonic_mapping: T
) -> impl ColumnValues<Output>where
C: ColumnValues<Input> + 'static,
T: StrictlyMonotonicFn<Input, Output> + Send + Sync + 'static,
Input: PartialOrd + Debug + Send + Sync + Clone + 'static,
Output: PartialOrd + Debug + Send + Sync + Clone + 'static,
Expand description
Creates a view of a column transformed by a strictly monotonic mapping. See
StrictlyMonotonicFn
.
E.g. apply a gcd monotonic_mapping([100, 200, 300]) == [1, 2, 3] monotonic_mapping.mapping() is expected to be injective, and we should always have monotonic_mapping.inverse(monotonic_mapping.mapping(el)) == el
The inverse of the mapping is required for:
fn get_positions_for_value_range(&self, range: RangeInclusive<T>) -> Vec<u64>
The user provides the original value range and we need to monotonic map them in the same way the
serialization does before calling the underlying column.
Note that when opening a codec, the monotonic_mapping should be the inverse of the mapping during serialization. And therefore the monotonic_mapping_inv when opening is the same as monotonic_mapping during serialization.