Struct rustis::commands::FtCreateOptions

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

Options for the ft_create command

Implementations§

source§

impl FtCreateOptions

source

pub fn on(self, data_type: FtIndexDataType) -> Self

currently supports HASH (default) and JSON. To index JSON, you must have the RedisJSON module installed.

source

pub fn prefix<P: SingleArg, PP: SingleArgCollection<P>>( self, prefixes: PP ) -> Self

tells the index which keys it should index.

You can add several prefixes to index. Because the argument is optional, the default is * (all keys).

source

pub fn filter<F: SingleArg>(self, filter: F) -> Self

filter expression with the full RediSearch aggregation expression language.

It is possible to use @__key to access the key that was just added/changed. A field can be used to set field name by passing FILTER @indexName=="myindexname".

source

pub fn language(self, default_lang: FtLanguage) -> Self

if set, indicates the default language for documents in the index.

Default to English.

A stemmer is used for the supplied language during indexing. If an unsupported language is sent, the command returns an error. The supported languages are Arabic, Basque, Catalan, Danish, Dutch, English, Finnish, French, German, Greek, Hungarian, Indonesian, Irish, Italian, Lithuanian, Nepali, Norwegian, Portuguese, Romanian, Russian, Spanish, Swedish, Tamil, Turkish, and Chinese.

When adding Chinese language documents, set LANGUAGE chinese for the indexer to properly tokenize the terms. If you use the default language, then search terms are extracted based on punctuation characters and whitespace. The Chinese language tokenizer makes use of a segmentation algorithm (via Friso), which segments text and checks it against a predefined dictionary. See Stemming for more information.

source

pub fn language_field<L: SingleArg>(self, default_lang: L) -> Self

document attribute set as the document language.

source

pub fn score(self, default_score: f64) -> Self

default score for documents in the index.

Default score is 1.0.

source

pub fn score_field<S: SingleArg>(self, score_attribute: S) -> Self

document attribute that you use as the document rank based on the user ranking.

Ranking must be between 0.0 and 1.0. If not set, the default score is 1.

source

pub fn payload_field<P: SingleArg>(self, payload_attribute: P) -> Self

document attribute that you use as a binary safe payload string to the document that can be evaluated at query time by a custom scoring function or retrieved to the client.

source

pub fn max_text_fields(self) -> Self

forces RediSearch to encode indexes as if there were more than 32 text attributes, which allows you to add additional attributes (beyond 32) using ft_alter.

For efficiency, RediSearch encodes indexes differently if they are created with less than 32 text attributes.

source

pub fn no_offsets(self) -> Self

does not store term offsets for documents.

It saves memory, but does not allow exact searches or highlighting. It implies NOHL.

source

pub fn temporary(self, expiration_sec: u64) -> Self

creates a lightweight temporary index that expires after a specified period of inactivity.

  • expiration_sec - index will expire after this duration in seconds.

The internal idle timer is reset whenever the index is searched or added to. Because such indexes are lightweight, you can create thousands of such indexes without negative performance implications and, therefore, you should consider using SKIPINITIALSCAN to avoid costly scanning.

source

pub fn nohl(self) -> Self

conserves storage space and memory by disabling highlighting support.

If set, the corresponding byte offsets for term positions are not stored. NOHL is also implied by NOOFFSETS.

source

pub fn nofields(self) -> Self

does not store attribute bits for each term.

It saves memory, but it does not allow filtering by specific attributes.

source

pub fn nofreqs(self) -> Self

avoids saving the term frequencies in the index.

It saves memory, but does not allow sorting based on the frequencies of a given term within the document.

source

pub fn skip_initial_scan(self) -> Self

if set, does not scan and index.

source

pub fn stop_words<W, WW>(self, stop_words: WW) -> Self
where W: SingleArg, WW: SingleArgCollection<W>,

sets the index with a custom stopword list, to be ignored during indexing and search time.

§Arguments
  • stop_words - a list of stopword arguments.

If not set, FT.CREATE takes the default list of stopwords. If count is set to 0, the index does not have stopwords.

Trait Implementations§

source§

impl Default for FtCreateOptions

source§

fn default() -> FtCreateOptions

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

impl ToArgs for FtCreateOptions

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, 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> MultipleArgsCollection<T> for T
where T: ToArgs,