[][src]Struct tantivy::tokenizer::TextAnalyzer

pub struct TextAnalyzer { /* fields omitted */ }

TextAnalyzer tokenizes an input text into tokens and modifies the resulting TokenStream.

It simply wraps a Tokenizer and a list of TokenFilter that are applied sequentially.

Methods

impl TextAnalyzer[src]

pub fn new<T: Tokenizer>(
    tokenizer: T,
    token_filters: Vec<BoxTokenFilter>
) -> TextAnalyzer
[src]

Creates a new TextAnalyzer given a tokenizer and a vector of BoxTokenFilter.

When creating a TextAnalyzer from a Tokenizer alone, prefer using TextAnalyzer::from(tokenizer).

pub fn filter<F: Into<BoxTokenFilter>>(self, token_filter: F) -> Self[src]

Appends a token filter to the current tokenizer.

The method consumes the current TokenStream and returns a new one.

Example

use tantivy::tokenizer::*;

let en_stem = TextAnalyzer::from(SimpleTokenizer)
    .filter(RemoveLongFilter::limit(40))
    .filter(LowerCaser)
    .filter(Stemmer::default());

pub fn token_stream_texts<'a>(&self, texts: &'a [&'a str]) -> BoxTokenStream<'a>[src]

Tokenize an array&str

The resulting BoxTokenStream is equivalent to what would be obtained if the &str were one concatenated &str, with an artificial position gap of 2 between the different fields to prevent accidental PhraseQuery to match accross two terms.

pub fn token_stream<'a>(&self, text: &'a str) -> BoxTokenStream<'a>[src]

Creates a token stream for a given str.

Trait Implementations

impl Clone for TextAnalyzer[src]

impl<T: Tokenizer> From<T> for TextAnalyzer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T> Fruit for T where
    T: Send + Downcast
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,