Struct elasticsearch_dsl::analyze::Analyze
source · pub struct Analyze { /* private fields */ }
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§
source§impl Analyze
impl Analyze
sourcepub fn new<S>(text: S) -> Selfwhere
S: Into<StringOrVecString>,
pub fn new<S>(text: S) -> Selfwhere S: Into<StringOrVecString>,
Creates an instance of Analyze
text
- Text to analyze. If an array of strings is provided, it is analyzed as a multi-value field.
sourcepub fn analyzer<S>(self, analyzer: S) -> Selfwhere
S: Into<Analysis>,
pub fn analyzer<S>(self, analyzer: S) -> Selfwhere S: Into<Analysis>,
Specify an analyzer, either it’s built-in analyzer, custom analyzer, built-in normalizer, custom normalizer or field
sourcepub fn attributes<I>(self, attributes: I) -> Selfwhere
I: IntoIterator,
I::Item: ToString,
pub fn attributes<I>(self, attributes: I) -> Selfwhere I: IntoIterator, I::Item: ToString,
Array of token attributes used to filter the output of the explain parameter.
Trait Implementations§
source§impl PartialEq<Analyze> for Analyze
impl PartialEq<Analyze> for Analyze
impl Eq for Analyze
impl StructuralEq for Analyze
impl StructuralPartialEq for Analyze
Auto Trait Implementations§
impl RefUnwindSafe for Analyze
impl Send for Analyze
impl Sync for Analyze
impl Unpin for Analyze
impl UnwindSafe for Analyze
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more