pub struct PhoneticTokenFilter { /* private fields */ }
phonetic
only.Expand description
This the phonetic token filter. It generates a token according to the algorithm provided.
You should use PhoneticAlgorithm to construct a new PhoneticTokenFilter.
use tantivy_analysis_contrib::phonetic::{Alternate, MaxCodeLength, PhoneticAlgorithm, PhoneticTokenFilter, Strict};
// Example with Double Metaphone.
let algorithm = PhoneticAlgorithm::DoubleMetaphone(MaxCodeLength(None), Alternate(false));
let token_filter = PhoneticTokenFilter::try_from(algorithm)?;
// Another example with Nysiis
let algorithm = PhoneticAlgorithm::Nysiis(Strict(None));
let token_filter = PhoneticTokenFilter::try_from(algorithm)?;
Trait Implementations§
source§impl Clone for PhoneticTokenFilter
impl Clone for PhoneticTokenFilter
source§fn clone(&self) -> PhoneticTokenFilter
fn clone(&self) -> PhoneticTokenFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PhoneticTokenFilter
impl Debug for PhoneticTokenFilter
source§impl TokenFilter for PhoneticTokenFilter
impl TokenFilter for PhoneticTokenFilter
source§impl TryFrom<&PhoneticAlgorithm> for PhoneticTokenFilter
impl TryFrom<&PhoneticAlgorithm> for PhoneticTokenFilter
Get the token filter from a PhoneticAlgorithm. This will take care of all the boilerplate.
Encoded values will be added as synonyms; that means the original token will be present.
source§impl TryFrom<(&PhoneticAlgorithm, bool)> for PhoneticTokenFilter
impl TryFrom<(&PhoneticAlgorithm, bool)> for PhoneticTokenFilter
Get the token filter from a PhoneticAlgorithm. This will take care of all the boilerplate.
The boolean indicates if encoded values should be treated as synonyms (true
), in
this case the original token will be present, or if it should replace (false
) the
original token.
source§impl TryFrom<(PhoneticAlgorithm, bool)> for PhoneticTokenFilter
impl TryFrom<(PhoneticAlgorithm, bool)> for PhoneticTokenFilter
Get the token filter from a PhoneticAlgorithm. This will take care of all the boilerplate.
The boolean indicates if encoded values should be treated as synonyms (true
), in
this case the original token will be present, or if it should replace (false
) the
original token.
source§impl TryFrom<PhoneticAlgorithm> for PhoneticTokenFilter
impl TryFrom<PhoneticAlgorithm> for PhoneticTokenFilter
Get the token filter from a PhoneticAlgorithm. This will take care of all the boilerplate.
Encoded values will be added as synonyms; that means the original token will be present.