pub struct KeySearchEngine { /* private fields */ }Expand description
Key search engine
Implementations§
Source§impl KeySearchEngine
impl KeySearchEngine
pub fn new(engine_type: SearchEngineType) -> Self
Sourcepub fn index_key(&mut self, key_id: &str, metadata: &KeyMetadata)
pub fn index_key(&mut self, key_id: &str, metadata: &KeyMetadata)
Index a key together with its metadata.
The metadata is stored verbatim so that subsequent Self::search
calls can filter on algorithm, creation date, and the textual
representation of the metadata fields.
Sourcepub fn add_tag(&mut self, key_id: &str, tag: &str)
pub fn add_tag(&mut self, key_id: &str, tag: &str)
Attach a tag to a previously indexed key. Tags are case-sensitive but compared case-insensitively during search.
Sourcepub fn set_purpose(&mut self, key_id: &str, purpose: KeyPurpose)
pub fn set_purpose(&mut self, key_id: &str, purpose: KeyPurpose)
Assign a purpose to a previously indexed key.
Sourcepub fn indexed_key_count(&self) -> usize
pub fn indexed_key_count(&self) -> usize
Number of indexed keys.
Sourcepub fn search(&self, query: &SearchQuery) -> Vec<SearchResult>
pub fn search(&self, query: &SearchQuery) -> Vec<SearchResult>
Run a structured SearchQuery against the indexed keys.
Each populated query field acts as both a hard filter (non-matching
keys are excluded) and a relevance signal. Relevance is accumulated:
an exact match contributes 1.0, a partial (substring) match
contributes 0.5. Results are returned sorted by descending
relevance score.
Auto Trait Implementations§
impl Freeze for KeySearchEngine
impl RefUnwindSafe for KeySearchEngine
impl Send for KeySearchEngine
impl Sync for KeySearchEngine
impl Unpin for KeySearchEngine
impl UnsafeUnpin for KeySearchEngine
impl UnwindSafe for KeySearchEngine
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
Aggregate shares in an MPC protocol.
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more