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 field Sort. The compile-time gate for SortBuilder::by / tiebreak: implemented for the orderable leaf handles (Keyword, Text, Number<K>, Date, Bool) and not for Geo / Object / map handles, so by(geo_handle, …) fails to compile (geo sorts go through SortBuilder::near / raw).

.asc() / .desc() are nesting-aware: a field inside one or more nested arrays renders the matching nested chain automatically, from the handle’s 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, Sub> Sortable for Keyword<S, Sub>

Source§

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

Source§

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

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.