Struct rustis::commands::FtAggregateOptions

source ·
pub struct FtAggregateOptions { /* private fields */ }
Available on crate feature redis-search only.
Expand description

Options for the ft_create command

Implementations§

source§

impl FtAggregateOptions

source

pub fn verbatim(self) -> Self

if set, does not try to use stemming for query expansion but searches the query terms verbatim.

Attributes needed for aggregations should be stored as SORTABLE, where they are available to the aggregation pipeline with very low latency. LOAD hurts the performance of aggregate queries considerably because every processed record needs to execute the equivalent of HMGET against a Redis key, which when executed over millions of keys, amounts to high processing times.

source

pub fn load<A: MultipleArgsCollection<FtLoadAttribute>>( self, attributes: A ) -> Self

loads document attributes from the source document.

source

pub fn load_all(self) -> Self

all attributes in a document are loaded.

source

pub fn groupby<P, PP, R>(self, properties: PP, reducers: R) -> Self

groups the results in the pipeline based on one or more properties.

Each group should have at least one reducer, a function that handles the group entries, either counting them, or performing multiple aggregate operations (see FtReducer).

source

pub fn sortby<P>(self, properties: P, max: Option<usize>) -> Self

Sort the pipeline up until the point of SORTBY, using a list of properties.

max is used to optimized sorting, by sorting only for the n-largest elements. Although it is not connected to limit, you usually need just SORTBY … MAX for common queries.

source

pub fn apply<E, N>(self, expr: E, name: N) -> Self
where E: SingleArg, N: SingleArg,

applies a 1-to-1 transformation on one or more properties and either stores the result as a new property down the pipeline or replaces any property using this transformation.

expr is an expression that can be used to perform arithmetic operations on numeric properties, or functions that can be applied on properties depending on their types (see below), or any combination thereof. For example, APPLY "sqrt(@foo)/log(@bar) + 5" AS baz evaluates this expression dynamically for each record in the pipeline and store the result as a new property called baz, which can be referenced by further APPLY/SORTBY/GROUPBY/REDUCE operations down the pipeline.

source

pub fn limit(self, offset: usize, num: usize) -> Self

Limits the number of results to return just num results starting at index offset (zero-based).

It is much more efficient to use SORTBY … MAX if you are interested in just limiting the output of a sort operation. If a key expires during the query, an attempt to load the key’s value will return a null array.

However, limit can be used to limit results without sorting, or for paging the n-largest results as determined by SORTBY MAX. For example, getting results 50-100 of the top 100 results is most efficiently expressed as SORTBY 1 @foo MAX 100 LIMIT 50 50. Removing the MAX from SORTBY results in the pipeline sorting all the records and then paging over results 50-100.

source

pub fn filter<E, N>(self, expr: E) -> Self
where E: SingleArg,

filters the results using predicate expressions relating to values in each result. They are applied post query and relate to the current state of the pipeline.

source

pub fn withcursor(self, options: FtWithCursorOptions) -> Self

Scan part of the results with a quicker alternative than limit. See Cursor API for more details.

source

pub fn timeout(self, milliseconds: u64) -> Self

if set, overrides the timeout parameter of the module.

source

pub fn params<N, V, P>(self, params: P) -> Self

defines one or more value parameters. Each parameter has a name and a value.

You can reference parameters in the query by a $, followed by the parameter name, for example, $user.

Each such reference in the search query to a parameter name is substituted by the corresponding parameter value. For example, with parameter definition params[("lon", 29.69465), ("lat", 34.95126)]), the expression @loc:[$lon $lat 10 km] is evaluated to @loc:[29.69465 34.95126 10 km]. You cannot reference parameters in the query string where concrete values are not allowed, such as in field names, for example, @loc. To use PARAMS, set dialect to 2 or greater than 2.

source

pub fn dialect(self, dialect_version: u64) -> Self

selects the dialect version under which to execute the query.

If not specified, the query will execute under the default dialect version set during module initial loading or via ft_config_set command.

Trait Implementations§

source§

impl Default for FtAggregateOptions

source§

fn default() -> FtAggregateOptions

Returns the “default value” for a type. Read more
source§

impl ToArgs for FtAggregateOptions

source§

fn write_args(&self, args: &mut CommandArgs)

Write this Rust type as one ore multiple args into CommandArgs. Read more
source§

fn num_args(&self) -> usize

Number arguments generated by this Rust type

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> MultipleArgsCollection<T> for T
where T: ToArgs,