Skip to main content

Sortable

Trait Sortable 

Source
pub trait Sortable {
    // Required methods
    fn asc(&self) -> Sort;
    fn desc(&self) -> Sort;
}
Expand description

A handle that can produce a Sort. The compile-time gate for SortBuilder::by / tiebreak: implemented for the orderable leaf handles (Keyword, Text, Number<K>, Date, Bool) and for a MapKeySort (Type::field().sort_key(..)), but not for a bare Geo / Object / map handle — so by(geo_handle, …) or by(map_handle, …) fails to compile (geo sorts go through SortBuilder::near / raw; a map sorts via its sort_key).

.asc() / .desc() are nesting-aware: a field (or map) inside one or more nested arrays renders the matching nested chain automatically, from the scope.

Required Methods§

Source

fn asc(&self) -> Sort

Sort ascending.

Source

fn desc(&self) -> Sort

Sort descending.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K, S: FlussoDocument> Sortable for Number<K, S>

Source§

impl<S: FlussoDocument> Sortable for Bool<S>

Source§

impl<S: FlussoDocument> Sortable for Date<S>

Source§

impl<S: FlussoDocument> Sortable for Keyword<S, NoSubfields>

Source§

impl<S: FlussoDocument> Sortable for Keyword<S, WithSubfields>

Source§

impl<S: FlussoDocument> Sortable for MapKeySort<S>

.asc() / .desc() build the _script sort; a bare value defaults to asc.

Source§

impl<S: FlussoDocument> Sortable for Text<S, WithSubfields>

Sorting a text field goes through its case/accent-insensitive .keyword_lowercase subfield (the analyzed field itself isn’t sortable), so it’s Sortable only when the field carries auto subfields.