[][src]Struct simsearch::SearchOptions

pub struct SearchOptions { /* fields omitted */ }

Options and flags which can be used to configure how the search engine works.

Examples

use simsearch::{SearchOptions, SimSearch};

let mut engine: SimSearch<usize> = SimSearch::new_with(
    SearchOptions::new().case_sensitive(true));

Methods

impl SearchOptions[src]

pub fn new() -> Self[src]

Creates a blank new set of options ready for configuration.

pub fn case_sensitive(self, case_sensitive: bool) -> Self[src]

Sets the option for case sensitive.

Defaults to false.

pub fn stop_whitespace(self, stop_whitespace: bool) -> Self[src]

Sets the option for whitespace tokenizing.

This option enables built-in tokenizer to split entry contents or search patterns by UTF-8 whitespace (including tab, returns and so forth).

See also std::str::split_whitespace().

Defaults to true.

pub fn stop_words(self, stop_words: &'static [&'static str]) -> Self[src]

Sets the option for custom tokenizing.

This option enables built-in tokenizer to split entry contents or search patterns by a list of custom stop words.

Defaults to be an empty list &[].

Examples

use simsearch::{SearchOptions, SimSearch};

let mut engine: SimSearch<usize> = SimSearch::new_with(
    SearchOptions::new().stop_words(&["/", "\\"]));

engine.insert(1, "the old/man/and/the sea");

let results = engine.search("old");

assert_eq!(results, &[1]);

pub fn threshold(self, threshold: f64) -> Self[src]

Sets the threshold for search scoring.

Search results will be sorted by their scores. Scores ranges from 0 to 1 when the 1 indicates the most relevant. Only the entries with scores greater than threshold will be returned.

Defaults to 0.7.

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.