pub struct InvertedIndex { /* private fields */ }Expand description
Inverted index for full-text search.
Implementations§
Source§impl InvertedIndex
impl InvertedIndex
pub fn new() -> Self
Sourcepub fn index_document(&mut self, doc_id: &DocumentId, text: &str)
pub fn index_document(&mut self, doc_id: &DocumentId, text: &str)
Index a document’s text.
Sourcepub fn unindex_document(&mut self, doc_id: &DocumentId, text: &str)
pub fn unindex_document(&mut self, doc_id: &DocumentId, text: &str)
Remove a document from the index.
Sourcepub fn search(&self, query: &str) -> Vec<DocumentId>
pub fn search(&self, query: &str) -> Vec<DocumentId>
Search for documents containing the query terms.
Sourcepub fn search_any(&self, query: &str) -> Vec<DocumentId>
pub fn search_any(&self, query: &str) -> Vec<DocumentId>
Search with OR semantics.
Sourcepub fn term_count(&self) -> usize
pub fn term_count(&self) -> usize
Get the number of unique terms.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InvertedIndex
impl RefUnwindSafe for InvertedIndex
impl Send for InvertedIndex
impl Sync for InvertedIndex
impl Unpin for InvertedIndex
impl UnsafeUnpin for InvertedIndex
impl UnwindSafe for InvertedIndex
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
Mutably borrows from an owned value. Read more