Struct elasticsearch_dsl::analyze::Analyze [−][src]
pub struct Analyze { /* fields omitted */ }
Expand description
Performs analysis on a text string and returns the resulting tokens.
The basic analyze
:
To analyze
with custom analyzer:
let custom_analyzer = CustomAnalyzer::new("whitespace")
.filter([
StringOrObject::String("lowercase".to_string()),
StringOrObject::Object(json!({"type": "stop", "stopwords": ["a", "is", "this"]})),
]);
let test = Analyze::new(["test this text", "and this one please"])
.analyzer(custom_analyzer)
.explain(true)
.attributes(["attributes"]);
To analyze
custom normalizer:
let custom_normalizer = CustomNormalizer::new()
.char_filter([
json!({ "type": "mapping", "mappings": ["٠ => 0", "١ => 1", "٢ => 2"] }),
])
.filter(["snowball"]);
let test = Analyze::new(["test this text", "and this one please"])
.analyzer(custom_normalizer)
.explain(true)
.attributes(["attributes"]);
Implementations
Creates an instance of Analyze
text
- Text to analyze. If an array of strings is provided, it is analyzed as a multi-value field.
Specify an analyzer, either it’s built-in analyzer, custom analyzer, built-in normalizer, custom normalizer or field
pub fn attributes<I>(self, attributes: I) -> Self where
I: IntoIterator,
I::Item: Into<String>,
pub fn attributes<I>(self, attributes: I) -> Self where
I: IntoIterator,
I::Item: Into<String>,
Array of token attributes used to filter the output of the explain parameter.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Analyze
impl UnwindSafe for Analyze
Blanket Implementations
Mutably borrows from an owned value. Read more