Struct rustis::commands::FtCreateOptions
source · pub struct FtCreateOptions { /* private fields */ }
redis-search
only.Expand description
Options for the ft_create
command
Implementations§
source§impl FtCreateOptions
impl FtCreateOptions
sourcepub fn on(self, data_type: FtIndexDataType) -> Self
pub fn on(self, data_type: FtIndexDataType) -> Self
currently supports HASH (default) and JSON.
To index JSON, you must have the RedisJSON
module installed.
sourcepub fn prefix<P: SingleArg, PP: SingleArgCollection<P>>(
self,
prefixes: PP
) -> Self
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).
sourcepub fn filter<F: SingleArg>(self, filter: F) -> Self
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"
.
sourcepub fn language(self, default_lang: FtLanguage) -> Self
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.
sourcepub fn language_field<L: SingleArg>(self, default_lang: L) -> Self
pub fn language_field<L: SingleArg>(self, default_lang: L) -> Self
document attribute set as the document language.
sourcepub fn score(self, default_score: f64) -> Self
pub fn score(self, default_score: f64) -> Self
default score for documents in the index.
Default score is 1.0.
sourcepub fn score_field<S: SingleArg>(self, score_attribute: S) -> Self
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.
sourcepub fn payload_field<P: SingleArg>(self, payload_attribute: P) -> Self
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.
sourcepub fn max_text_fields(self) -> Self
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.
sourcepub fn no_offsets(self) -> Self
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
.
sourcepub fn temporary(self, expiration_sec: u64) -> Self
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.
sourcepub fn nohl(self) -> Self
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
.
sourcepub fn nofields(self) -> Self
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.
sourcepub fn nofreqs(self) -> Self
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.
sourcepub fn skip_initial_scan(self) -> Self
pub fn skip_initial_scan(self) -> Self
if set, does not scan and index.