Trait rustis::commands::SearchCommands

source ·
pub trait SearchCommands<'a> {
Show 29 methods // Provided methods fn ft_aggregate<I, Q>( self, index: I, query: Q, options: FtAggregateOptions ) -> PreparedCommand<'a, Self, FtAggregateResult> where Self: Sized, I: SingleArg, Q: SingleArg { ... } fn ft_aliasadd<A, I>( self, alias: A, index: I ) -> PreparedCommand<'a, Self, ()> where Self: Sized, A: SingleArg, I: SingleArg { ... } fn ft_aliasdel<A>(self, alias: A) -> PreparedCommand<'a, Self, ()> where Self: Sized, A: SingleArg { ... } fn ft_aliasupdate<A, I>( self, alias: A, index: I ) -> PreparedCommand<'a, Self, ()> where Self: Sized, A: SingleArg, I: SingleArg { ... } fn ft_alter<I>( self, index: I, skip_initial_scan: bool, attribute: FtFieldSchema ) -> PreparedCommand<'a, Self, ()> where Self: Sized, I: SingleArg { ... } fn ft_config_get<O, N, V, R>( self, option: O ) -> PreparedCommand<'a, Self, R> where Self: Sized, O: SingleArg, N: PrimitiveResponse, V: PrimitiveResponse, R: KeyValueCollectionResponse<N, V> { ... } fn ft_config_set<O, V>( self, option: O, value: V ) -> PreparedCommand<'a, Self, ()> where Self: Sized, O: SingleArg, V: SingleArg { ... } fn ft_create<I, S>( self, index: I, options: FtCreateOptions, schema: S ) -> PreparedCommand<'a, Self, ()> where Self: Sized, I: SingleArg, S: MultipleArgsCollection<FtFieldSchema> { ... } fn ft_cursor_del<I>( self, index: I, cursor_id: u64 ) -> PreparedCommand<'a, Self, ()> where Self: Sized, I: SingleArg { ... } fn ft_cursor_read<I>( self, index: I, cursor_id: u64 ) -> PreparedCommand<'a, Self, FtAggregateResult> where Self: Sized, I: SingleArg { ... } fn ft_dictadd<D, T, TT>( self, dict: D, terms: TT ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, T: SingleArg, TT: SingleArgCollection<T> { ... } fn ft_dictdel<D, T, TT>( self, dict: D, terms: TT ) -> PreparedCommand<'a, Self, usize> where Self: Sized, D: SingleArg, T: SingleArg, TT: SingleArgCollection<T> { ... } fn ft_dictdump<D, T, TT>(self, dict: D) -> PreparedCommand<'a, Self, TT> where Self: Sized, D: SingleArg, T: PrimitiveResponse + DeserializeOwned, TT: CollectionResponse<T> { ... } fn ft_dropindex<I>( self, index: I, dd: bool ) -> PreparedCommand<'a, Self, ()> where Self: Sized, I: SingleArg { ... } fn ft_explain<I, Q, R>( self, index: I, query: Q, dialect_version: Option<u64> ) -> PreparedCommand<'a, Self, R> where Self: Sized, I: SingleArg, Q: SingleArg, R: PrimitiveResponse { ... } fn ft_explaincli<I, Q, R, RR>( self, index: I, query: Q, dialect_version: Option<u64> ) -> PreparedCommand<'a, Self, RR> where Self: Sized, I: SingleArg, Q: SingleArg, R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R> { ... } fn ft_info( self, index: impl SingleArg ) -> PreparedCommand<'a, Self, FtInfoResult> where Self: Sized { ... } fn ft_list<R, RR>(self) -> PreparedCommand<'a, Self, RR> where Self: Sized, R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R> { ... } fn ft_profile_search<I, Q, QQ>( self, index: I, limited: bool, query: QQ ) -> PreparedCommand<'a, Self, FtProfileSearchResult> where Self: Sized, I: SingleArg, Q: SingleArg, QQ: SingleArgCollection<Q> { ... } fn ft_profile_aggregate<I, Q, QQ>( self, index: I, limited: bool, query: QQ ) -> PreparedCommand<'a, Self, FtProfileAggregateResult> where Self: Sized, I: SingleArg, Q: SingleArg, QQ: SingleArgCollection<Q> { ... } fn ft_search<I, Q>( self, index: I, query: Q, options: FtSearchOptions ) -> PreparedCommand<'a, Self, FtSearchResult> where Self: Sized, I: SingleArg, Q: SingleArg { ... } fn ft_spellcheck<I, Q>( self, index: I, query: Q, options: FtSpellCheckOptions ) -> PreparedCommand<'a, Self, FtSpellCheckResult> where Self: Sized, I: SingleArg, Q: SingleArg { ... } fn ft_syndump<I, R>(self, index: I) -> PreparedCommand<'a, Self, R> where Self: Sized, I: SingleArg, R: KeyValueCollectionResponse<String, Vec<String>> { ... } fn ft_synupdate<T: SingleArg>( self, index: impl SingleArg, synonym_group_id: impl SingleArg, skip_initial_scan: bool, terms: impl SingleArgCollection<T> ) -> PreparedCommand<'a, Self, ()> where Self: Sized { ... } fn ft_tagvals<R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R>>( self, index: impl SingleArg, field_name: impl SingleArg ) -> PreparedCommand<'a, Self, RR> where Self: Sized { ... } fn ft_sugadd( self, key: impl SingleArg, string: impl SingleArg, score: f64, options: FtSugAddOptions ) -> PreparedCommand<'a, Self, usize> where Self: Sized { ... } fn ft_sugdel( self, key: impl SingleArg, string: impl SingleArg ) -> PreparedCommand<'a, Self, bool> where Self: Sized { ... } fn ft_sugget( self, key: impl SingleArg, prefix: impl SingleArg, options: FtSugGetOptions ) -> PreparedCommand<'a, Self, Vec<FtSuggestion>> where Self: Sized { ... } fn ft_suglen(self, key: impl SingleArg) -> PreparedCommand<'a, Self, usize> where Self: Sized { ... }
}
Available on crate feature redis-search only.
Expand description

A group of Redis commands related to RedisSearch

§See Also

Provided Methods§

source

fn ft_aggregate<I, Q>( self, index: I, query: Q, options: FtAggregateOptions ) -> PreparedCommand<'a, Self, FtAggregateResult>
where Self: Sized, I: SingleArg, Q: SingleArg,

Run a search query on an index, and perform aggregate transformations on the results, extracting statistics etc from them

§Arguments
  • index - index against which the query is executed.
  • query- is base filtering query that retrieves the documents.
    It follows the exact same syntax as the search query,
    including filters, unions, not, optional, and so on.
  • options - See FtAggregateOptions
§Returns

An instance of FtAggregateResult

§See Also
source

fn ft_aliasadd<A, I>(self, alias: A, index: I) -> PreparedCommand<'a, Self, ()>
where Self: Sized, A: SingleArg, I: SingleArg,

Add an alias to an index

§Arguments
  • index - The index.
  • alias - alias to be added to an index
§See Also

https://redis.io/commands/ft.aliasadd/

source

fn ft_aliasdel<A>(self, alias: A) -> PreparedCommand<'a, Self, ()>
where Self: Sized, A: SingleArg,

Remove an alias from an index

§Arguments
  • alias - alias to be removed
§See Also

https://redis.io/commands/ft.aliasdel/

source

fn ft_aliasupdate<A, I>( self, alias: A, index: I ) -> PreparedCommand<'a, Self, ()>
where Self: Sized, A: SingleArg, I: SingleArg,

Add an alias to an index.

If the alias is already associated with another index, this command removes the alias association with the previous index.

§Arguments
  • index - The index.
  • alias - alias to be added to an index
§See Also

https://redis.io/commands/ft.aliasupdate/

source

fn ft_alter<I>( self, index: I, skip_initial_scan: bool, attribute: FtFieldSchema ) -> PreparedCommand<'a, Self, ()>
where Self: Sized, I: SingleArg,

Add a new attribute to the index.

Adding an attribute to the index causes any future document updates to use the new attribute when indexing and reindexing existing documents.

§Arguments
  • index - index name to create.
  • skip_initial_scan - if set, does not scan and index.
  • attribute - attribute to add.
§See Also

https://redis.io/commands/ft.alter/

source

fn ft_config_get<O, N, V, R>(self, option: O) -> PreparedCommand<'a, Self, R>

Retrieve configuration options

§Arguments
  • option - name of the configuration option, or ‘*’ for all.
§Return

Key/value collection holding names & values of the requested configs

§See Also

https://redis.io/commands/ft.config-get/

source

fn ft_config_set<O, V>( self, option: O, value: V ) -> PreparedCommand<'a, Self, ()>
where Self: Sized, O: SingleArg, V: SingleArg,

Set configuration options

§Arguments
  • option - name of the configuration option
  • value - value of the configuration option.
§See Also

https://redis.io/commands/ft.config-set/

source

fn ft_create<I, S>( self, index: I, options: FtCreateOptions, schema: S ) -> PreparedCommand<'a, Self, ()>

Create an index with the given specification

§Arguments
  • index - Name of the index to create. If it exists, the old specification is overwritten.
§See Also
source

fn ft_cursor_del<I>( self, index: I, cursor_id: u64 ) -> PreparedCommand<'a, Self, ()>
where Self: Sized, I: SingleArg,

Delete a cursor

§Arguments
  • index - index name.
  • cursor_id - id of the cursor
§See Also

https://redis.io/commands/ft.cursor-del/

source

fn ft_cursor_read<I>( self, index: I, cursor_id: u64 ) -> PreparedCommand<'a, Self, FtAggregateResult>
where Self: Sized, I: SingleArg,

Read next results from an existing cursor

§Arguments
  • index - index name.
  • cursor_id - id of the cursor.
  • read_size - number of results to read. This parameter overrides count specified in ft_aggregate.
§Returns

an instance of FtAggregateResult

§See Also

https://redis.io/commands/ft.cursor-read/

source

fn ft_dictadd<D, T, TT>( self, dict: D, terms: TT ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, D: SingleArg, T: SingleArg, TT: SingleArgCollection<T>,

Add terms to a dictionary

§Arguments
  • dict - dictionary name.
  • terms - terms to add to the dictionary.
§Return

the number of new terms that were added.

§See Also

https://redis.io/commands/ft.dictadd/

source

fn ft_dictdel<D, T, TT>( self, dict: D, terms: TT ) -> PreparedCommand<'a, Self, usize>
where Self: Sized, D: SingleArg, T: SingleArg, TT: SingleArgCollection<T>,

Delete terms from a dictionary

§Arguments
  • dict - dictionary name.
  • terms - terms to delete from the dictionary.
§Return

the number of terms that were deleted.

§See Also

https://redis.io/commands/ft.dictdel/

source

fn ft_dictdump<D, T, TT>(self, dict: D) -> PreparedCommand<'a, Self, TT>

Dump all terms in the given dictionary

§Arguments
  • dict - dictionary name.
§Return

A collection, where each element is a term (bulkstring).

§See Also

https://redis.io/commands/ft.dictdump/

source

fn ft_dropindex<I>(self, index: I, dd: bool) -> PreparedCommand<'a, Self, ()>
where Self: Sized, I: SingleArg,

Delete an index

§Arguments
  • index - full-text index name. You must first create the index using ft_create.
  • dd - drop operation that, if set, deletes the actual document hashes
§Notes
  • By default, ft_dropindex does not delete the document hashes associated with the index. Adding the dd option deletes the hashes as well.
  • When using ft_dropindex with the parameter dd, if an index creation is still running (ft_create is running asynchronously), only the document hashes that have already been indexed are deleted. The document hashes left to be indexed remain in the database. You can use ft_info to check the completion of the indexing.
§Return

the number of new terms that were added.

§See Also

https://redis.io/commands/ft.dropindex/

source

fn ft_explain<I, Q, R>( self, index: I, query: Q, dialect_version: Option<u64> ) -> PreparedCommand<'a, Self, R>
where Self: Sized, I: SingleArg, Q: SingleArg, R: PrimitiveResponse,

Return the execution plan for a complex query

§Arguments
  • index - full-text index name. You must first create the index using ft_create.
  • query - query string, as if sent to ft_search.
  • dialect_version - dialect version under which to execute the query.
    If not specified, the query executes under the default dialect version set during module initial loading
    or via ft_config_set command.
§Notes
  • In the returned response, a + on a term is an indication of stemming.
  • redis-cli --raw to properly read line-breaks in the returned response.
§Return

a string representing the execution plan.

§See Also

https://redis.io/commands/ft.explain/

source

fn ft_explaincli<I, Q, R, RR>( self, index: I, query: Q, dialect_version: Option<u64> ) -> PreparedCommand<'a, Self, RR>

Return the execution plan for a complex query but formatted for easier reading without using redis-cli --raw

§Arguments
  • index - full-text index name. You must first create the index using ft_create.
  • query - query string, as if sent to ft_search.
  • dialect_version - dialect version under which to execute the query.
    If not specified, the query executes under the default dialect version set during module initial loading
    or via ft_config_set command.
§Notes
  • In the returned response, a + on a term is an indication of stemming.
§Return

a collection of strings representing the execution plan.

§See Also

https://redis.io/commands/ft.explaincli/

source

fn ft_info( self, index: impl SingleArg ) -> PreparedCommand<'a, Self, FtInfoResult>
where Self: Sized,

Return information and statistics on the index

§Arguments
  • index - full-text index name. You must first create the index using ft_create.
§Return

an instance of FtInfoResult

§See Also

https://redis.io/commands/ft.info/

source

fn ft_list<R, RR>(self) -> PreparedCommand<'a, Self, RR>

Returns a list of all existing indexes.

§Return

A collection of index names.

§See Also

https://redis.io/commands/ft._list/

Perform a ft_search command and collects performance information

§Arguments
  • index - index name. You must first create the index using ft_create.
  • limited - if set, removes details of reader iterator.
  • query - collection of query parameters (non including the index name)
§Note

To reduce the size of the output, use nocontent or limit(0,0) to reduce results reply or LIMITED to not reply with details of reader iterators inside builtin-unions such as fuzzy or prefix.

§Return

An instance of FtProfileSearchResult

§See Also

https://redis.io/commands/ft.profile/

source

fn ft_profile_aggregate<I, Q, QQ>( self, index: I, limited: bool, query: QQ ) -> PreparedCommand<'a, Self, FtProfileAggregateResult>
where Self: Sized, I: SingleArg, Q: SingleArg, QQ: SingleArgCollection<Q>,

Perform a ft_aggregate command and collects performance information

§Arguments
  • index - index name. You must first create the index using ft_create.
  • limited - if set, removes details of reader iterator.
  • query - collection of query parameters (non including the index name)
§Note

To reduce the size of the output, use nocontent or limit(0,0) to reduce results reply or LIMITED to not reply with details of reader iterators inside builtin-unions such as fuzzy or prefix.

§Return

An instance of FtProfileAggregateResult

§See Also

https://redis.io/commands/ft.profile/

Search the index with a textual query, returning either documents or just ids

§Arguments
§Return

An instance of FtSearchResult

§See Also

https://redis.io/commands/ft.search/

source

fn ft_spellcheck<I, Q>( self, index: I, query: Q, options: FtSpellCheckOptions ) -> PreparedCommand<'a, Self, FtSpellCheckResult>
where Self: Sized, I: SingleArg, Q: SingleArg,

Perform spelling correction on a query, returning suggestions for misspelled terms

§Arguments
§Return

An instance of FtSpellCheckResult

§See Also

https://redis.io/commands/ft.spellcheck/

source

fn ft_syndump<I, R>(self, index: I) -> PreparedCommand<'a, Self, R>

Dump the contents of a synonym group

§Arguments
  • index - index name. You must first create the index using ft_create.
§Return

This command returns a list of synonym terms and their synonym group ids.

§See Also
source

fn ft_synupdate<T: SingleArg>( self, index: impl SingleArg, synonym_group_id: impl SingleArg, skip_initial_scan: bool, terms: impl SingleArgCollection<T> ) -> PreparedCommand<'a, Self, ()>
where Self: Sized,

Update a synonym group

Use this command to create or update a synonym group with additional terms. The command triggers a scan of all documents. ///

§Arguments
  • index - index name. You must first create the index using ft_create.
  • synonym_group_id - synonym group to return.
  • skip_initial_scan - does not scan and index, and only documents that are indexed after the update are affected.
  • terms - terms to add to the synonym group
§Return

This command returns a list of synonym terms and their synonym group ids.

§See Also
source

fn ft_tagvals<R: PrimitiveResponse + DeserializeOwned, RR: CollectionResponse<R>>( self, index: impl SingleArg, field_name: impl SingleArg ) -> PreparedCommand<'a, Self, RR>
where Self: Sized,

Return a distinct set of values indexed in a Tag field

Use this command if your tag indexes things like cities, categories, and so on.

§Arguments
  • index - index name. You must first create the index using ft_create.
  • field_name - name of a Tag file defined in the schema.
§Return

A coolection reply of all distinct tags in the tag index.

§See Also

https://redis.io/commands/ft.tagvals/

source

fn ft_sugadd( self, key: impl SingleArg, string: impl SingleArg, score: f64, options: FtSugAddOptions ) -> PreparedCommand<'a, Self, usize>
where Self: Sized,

Add a suggestion string to an auto-complete suggestion dictionary

The auto-complete suggestion dictionary is disconnected from the index definitions and leaves creating and updating suggestions dictionaries to the user.

§Arguments
  • key - suggestion dictionary key.
  • string - suggestion string to index.
  • score - floating point number of the suggestion string’s weight.
  • options - See FtSugAddOptions
§Return

the current size of the suggestion dictionary.

§See Also

https://redis.io/commands/ft.sugadd/

source

fn ft_sugdel( self, key: impl SingleArg, string: impl SingleArg ) -> PreparedCommand<'a, Self, bool>
where Self: Sized,

Delete a string from a suggestion index

§Arguments
  • key - suggestion dictionary key.
  • string - suggestion string to delete
§Return
  • true - if the string was found and deleted
  • false - otherwise
§See Also

https://redis.io/commands/ft.sugdel/

source

fn ft_sugget( self, key: impl SingleArg, prefix: impl SingleArg, options: FtSugGetOptions ) -> PreparedCommand<'a, Self, Vec<FtSuggestion>>
where Self: Sized,

Get completion suggestions for a prefix

§Arguments
  • key - suggestion dictionary key.
  • prefix - prefix to complete on.
  • options - See FtSugGetOptions
§Return

A collection of the top suggestions matching the prefix

§See Also

https://redis.io/commands/ft.sugget/

source

fn ft_suglen(self, key: impl SingleArg) -> PreparedCommand<'a, Self, usize>
where Self: Sized,

Get the size of an auto-complete suggestion dictionary

§Arguments
  • key - suggestion dictionary key.
§Return

The the current size of the suggestion dictionary.

§See Also

https://redis.io/commands/ft.suglen/

Implementors§

source§

impl<'a> SearchCommands<'a> for &'a Client

source§

impl<'a> SearchCommands<'a> for &'a mut Transaction

source§

impl<'a, 'b> SearchCommands<'a> for &'a mut Pipeline<'b>