pub struct LexicalIndex { /* private fields */ }Expand description
In-memory lexical index.
Implementations§
Source§impl LexicalIndex
impl LexicalIndex
Sourcepub fn new(documents: Vec<LexicalDocument>) -> Self
pub fn new(documents: Vec<LexicalDocument>) -> Self
Builds an index from already accepted memory documents.
Sourcepub fn search(&self, query: &str) -> CortexResult<Vec<LexicalHit>>
pub fn search(&self, query: &str) -> CortexResult<Vec<LexicalHit>>
Returns matching documents ranked by lexical overlap with query.
Sourcepub fn search_with_tag_filter(
&self,
query: &str,
required_tags: &[String],
) -> CortexResult<Vec<LexicalHit>>
pub fn search_with_tag_filter( &self, query: &str, required_tags: &[String], ) -> CortexResult<Vec<LexicalHit>>
Returns matching documents ranked by lexical overlap with query,
restricted to documents whose domains tags carry every entry in
required_tags (AND semantics).
The tag filter runs as a pre-pass: documents that fail the AND
closure are skipped before any lexical scoring work. An empty
required_tags slice disables filtering and yields the same hits
as Self::search. Duplicate tag inputs are coalesced.
Trait Implementations§
Source§impl Clone for LexicalIndex
impl Clone for LexicalIndex
Source§fn clone(&self) -> LexicalIndex
fn clone(&self) -> LexicalIndex
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LexicalIndex
impl Debug for LexicalIndex
Source§impl Default for LexicalIndex
impl Default for LexicalIndex
Source§fn default() -> LexicalIndex
fn default() -> LexicalIndex
Returns the “default value” for a type. Read more
Source§impl PartialEq for LexicalIndex
impl PartialEq for LexicalIndex
Source§fn eq(&self, other: &LexicalIndex) -> bool
fn eq(&self, other: &LexicalIndex) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for LexicalIndex
impl StructuralPartialEq for LexicalIndex
Auto Trait Implementations§
impl Freeze for LexicalIndex
impl RefUnwindSafe for LexicalIndex
impl Send for LexicalIndex
impl Sync for LexicalIndex
impl Unpin for LexicalIndex
impl UnsafeUnpin for LexicalIndex
impl UnwindSafe for LexicalIndex
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