pub struct Lossless { /* private fields */ }
Expand description
Index which keeps track of all occurrences of all words.
Much (10x) faster than Simple
, but memory usage grows linearly with content added.
Simple
s memory usage grows only with word count & document count.
If you have relatively short documents, this doesn’t take up a lot more memory (only about 2-4x).
Implementations§
source§impl Lossless
impl Lossless
sourcepub fn new(
proximity_threshold: f32,
proximity_algorithm: Algorithm,
word_count_limit: usize,
) -> Self
pub fn new( proximity_threshold: f32, proximity_algorithm: Algorithm, word_count_limit: usize, ) -> Self
proximity_threshold
is the threshold where alike words are also accepted.
It uses the range [0..1], where values nearer 0 allow more words.
The default is 0.9
.
proximity_threshold
is the algorithm used for proximity checking of words.
word_count_limit
is the number of words in this index where only words with the first
character is used for approximate matching.
Default is 2_500
.
Trait Implementations§
source§impl<'a> Provider<'a> for Lossless
impl<'a> Provider<'a> for Lossless
source§fn remove_document(&mut self, document: Id)
fn remove_document(&mut self, document: Id)
O(n log n)
source§fn documents_with_word(
&'a self,
word: impl AsRef<str>,
) -> Option<Self::DocumentIter>
fn documents_with_word( &'a self, word: impl AsRef<str>, ) -> Option<Self::DocumentIter>
O(log n)
Iterator is O(1) - running this and consuming the iterator is O(n log n).
You can get the length of the list using the ExactSizeIterator
trait.
type DocumentIter = Copied<Keys<'a, Id, LosslessDocOccurrences>>
type WordIter = Keys<'a, Arc<Alphanumeral<StrPtr>>, LosslessDocMap>
type WordFilteredIter = Map<Range<'a, Arc<Alphanumeral<StrPtr>>, LosslessDocMap>, fn(_: (&'a Arc<Alphanumeral<StrPtr>>, &'a LosslessDocMap)) -> &'a Arc<Alphanumeral<StrPtr>>>
source§fn size(&self) -> usize
fn size(&self) -> usize
fn word_count_upper_limit(&self) -> usize
source§fn word_count_limit(&self) -> usize
fn word_count_limit(&self) -> usize
Self::word_count_upper_limit
where Self::words_starting_with
is used
instead of Self::words
.fn words(&'a self) -> Self::WordIter
fn words_starting_with(&'a self, c: char) -> Self::WordFilteredIter
fn word_proximity_threshold(&self) -> f32
fn word_proximity_algorithm(&self) -> Algorithm
source§fn digest_document(&mut self, id: Id, content: &str)
fn digest_document(&mut self, id: Id, content: &str)
Auto Trait Implementations§
impl Freeze for Lossless
impl RefUnwindSafe for Lossless
impl Send for Lossless
impl Sync for Lossless
impl Unpin for Lossless
impl UnwindSafe for Lossless
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)