pub struct SearchEngine { /* private fields */ }Expand description
Fuzzy search engine backed by nucleo-matcher.
§Field coverage
Agent searches match against a single concatenated haystack built as:
"{id} {name} {provider} {summary}" — covering all four fields required
by Req 16.2 and 32.2.
Skill searches match against "{id} {name} {summary}" — id, name, and
summary as required by Req 32.2.
§Performance
For catalogs of < 100 assets (typical in this repository), fuzzy matching
completes well within the 100 ms budget stated in Req 16.2. No explicit
benchmarking infrastructure is included here; the design relies on
nucleo-matcher’s O(nm) algorithm being fast enough for this dataset size.
Implementations§
Source§impl SearchEngine
impl SearchEngine
pub fn new() -> Self
Sourcepub fn search_agents(
&mut self,
query: &str,
agents: &[Agent],
provider_filter: Option<&str>,
harness_filter: Option<&str>,
) -> Vec<usize>
pub fn search_agents( &mut self, query: &str, agents: &[Agent], provider_filter: Option<&str>, harness_filter: Option<&str>, ) -> Vec<usize>
Search agents by fuzzy matching against id, name, provider, and summary.
The haystack for each agent is "{id} {name} {provider} {summary}",
ensuring all four fields specified in Req 32.2 are covered.
§Filtering
provider_filter and harness_filter are applied first (intersection),
then fuzzy matching is applied to the remaining candidates.
§Empty query
If query is empty AND no filters are active, all agent indices are
returned in original order (score 0). If filters are active but the
query is empty, filtered candidates are returned in original order.
§Return value
Indices into agents sorted by match score descending (highest score
first), with ties broken by original index order (stable sort).
Sourcepub fn search_skills(&mut self, query: &str, skills: &[Skill]) -> Vec<usize>
pub fn search_skills(&mut self, query: &str, skills: &[Skill]) -> Vec<usize>
Search skills by fuzzy matching against id, name, and summary.
The haystack for each skill is "{id} {name} {summary}" — covering the
three fields applicable to skills (no provider field on Skill).
§Empty query
Returns all skill indices in original order.
§Return value
Indices into skills sorted by match score descending (stable).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SearchEngine
impl RefUnwindSafe for SearchEngine
impl Send for SearchEngine
impl Sync for SearchEngine
impl Unpin for SearchEngine
impl UnsafeUnpin for SearchEngine
impl UnwindSafe for SearchEngine
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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> ⓘ
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