[−][src]Struct simsearch::SearchOptions
Options and flags that configuring the search engine.
Examples
use simsearch::{SearchOptions, SimSearch}; let mut engine: SimSearch<usize> = SimSearch::new_with( SearchOptions::new().case_sensitive(true));
Implementations
impl SearchOptions
[src]
pub fn new() -> Self
[src]
Creates a default configuration.
pub fn case_sensitive(self, case_sensitive: bool) -> Self
[src]
Sets whether search engine is case sensitive or not.
Defaults to false
.
pub fn stop_whitespace(self, stop_whitespace: bool) -> Self
[src]
Sets the whether search engine splits tokens on whitespace or not. The whitespace here includes 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 custom token stop word.
This option enables tokenizer to split contents and search words by the extra list of custom stop words.
Defaults to &[]
.
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 Jaro winkler similarity scores. Scores ranges from 0 to 1 where the 1 indicates the most relevant. Only the entries with scores greater than the threshold will be returned.
Defaults to 0.8
.
pub fn levenshtein(self, levenshtein: bool) -> Self
[src]
Sets whether Levenshtein distance, which is SIMD-accelerated, should be used instead of the default Jaro-Winkler distance.
The implementation of Levenshtein distance is very fast but cannot handle Unicode strings, unlike the default Jaro-Winkler distance. The strings are treated as byte slices with Levenshtein distance, which means that the calculated score may be incorrectly lower for Unicode strings, where each character is represented with multiple bytes.
Defaults to false
.
Auto Trait Implementations
impl RefUnwindSafe for SearchOptions
impl Send for SearchOptions
impl Sync for SearchOptions
impl Unpin for SearchOptions
impl UnwindSafe for SearchOptions
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,