pub struct FtFieldSchema { /* private fields */ }
redis-search
only.Expand description
field schema for the ft_create
command
Implementations§
Source§impl FtFieldSchema
impl FtFieldSchema
Sourcepub fn identifier<N: SingleArg>(identifier: N) -> Self
pub fn identifier<N: SingleArg>(identifier: N) -> Self
- For hashes, is a field name within the hash.
- For JSON, the identifier is a JSON Path expression.
Sourcepub fn as_attribute<A: SingleArg>(self, as_attribute: A) -> Self
pub fn as_attribute<A: SingleArg>(self, as_attribute: A) -> Self
Defines the attribute associated to the identifier.
For example, you can use this feature to alias a complex JSONPath expression with more memorable (and easier to type) name.
Sourcepub fn field_type(self, field_type: FtFieldType) -> Self
pub fn field_type(self, field_type: FtFieldType) -> Self
The field type.
Mandatory option to be used after identifier
or as_attribute
Sourcepub fn sortable(self) -> Self
pub fn sortable(self) -> Self
Numeric, tag (not supported with JSON) or text attributes can have the optional SORTABLE
argument.
As the user sorts the results by the value of this attribute
,
the results will be available with very low latency.
(this adds memory overhead so consider not to declare it on large text attributes).
Sourcepub fn unf(self) -> Self
pub fn unf(self) -> Self
By default, SORTABLE applies a normalization to the indexed value (characters set to lowercase, removal of diacritics). When using un-normalized form (UNF), you can disable the normalization and keep the original form of the value.
Sourcepub fn nostem(self) -> Self
pub fn nostem(self) -> Self
Text attributes can have the NOSTEM
argument which will disable stemming when indexing its values.
This may be ideal for things like proper names.
Sourcepub fn noindex(self) -> Self
pub fn noindex(self) -> Self
Attributes can have the NOINDEX
option, which means they will not be indexed.
This is useful in conjunction with SORTABLE
,
to create attributes whose update using PARTIAL will not cause full reindexing of the document.
If an attribute has NOINDEX and doesn’t have SORTABLE, it will just be ignored by the index.
Sourcepub fn phonetic(self, matcher: FtPhoneticMatcher) -> Self
pub fn phonetic(self, matcher: FtPhoneticMatcher) -> Self
Declaring a text attribute as PHONETIC
will perform phonetic matching on it in searches by default.
The obligatory matcher
argument specifies the phonetic algorithm and language used.
Sourcepub fn weight(self, weight: f64) -> Self
pub fn weight(self, weight: f64) -> Self
for TEXT
attributes, declares the importance of this attribute when calculating result accuracy.
This is a multiplication factor, and defaults to 1 if not specified.
Sourcepub fn separator(self, sep: char) -> Self
pub fn separator(self, sep: char) -> Self
for TAG
attributes, indicates how the text contained in the attribute is to be split into individual tags.
The default is ,
. The value must be a single character.
Sourcepub fn case_sensitive(self) -> Self
pub fn case_sensitive(self) -> Self
for TAG
attributes, keeps the original letter cases of the tags.
If not specified, the characters are converted to lowercase.
Sourcepub fn with_suffix_trie(self) -> Self
pub fn with_suffix_trie(self) -> Self
for TEXT
and TAG
attributes, keeps a suffix trie
with all terms which match the suffix.
It is used to optimize contains
(foo) and suffix
(*foo) queries.
Otherwise, a brute-force search on the trie is performed.
If suffix trie exists for some fields, these queries will be disabled for other fields.