Struct elipdotter::index::Lossless

source ·
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. Simples 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

source

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.

source

pub fn ingest(&mut self, other: Self)

Merges other with self.

Trait Implementations§

source§

impl Clone for Lossless

source§

fn clone(&self) -> Lossless

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Lossless

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Lossless

Self::new with proximity_threshold set to 0.85.

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a> Provider<'a> for Lossless

source§

fn insert_word(&mut self, word: impl AsRef<str>, document: Id, index: usize)

O(log n log n)

source§

fn remove_document(&mut self, document: Id)

O(n log n)

source§

fn contains_word(&self, word: impl AsRef<str>, document: Id) -> bool

O(log n log n)

source§

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

Estimate of the number of bytes this index uses in memory, specifically the heap. Read more
source§

fn word_count_upper_limit(&self) -> usize

source§

fn word_count_limit(&self) -> usize

source§

fn words(&'a self) -> Self::WordIter

source§

fn words_starting_with(&'a self, c: char) -> Self::WordFilteredIter

source§

fn word_proximity_threshold(&self) -> f32

source§

fn word_proximity_algorithm(&self) -> Algorithm

source§

fn digest_document(&mut self, id: Id, content: &str)

Only adds words which are alphanumeric.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.