pub struct RelevanceQuery { /* private fields */ }Expand description
Parsed query reused while scoring all candidate memories.
Implementations§
Source§impl RelevanceQuery
impl RelevanceQuery
pub fn new(query: &str) -> Self
pub fn is_empty(&self) -> bool
Sourcepub fn tokens(&self) -> &[String]
pub fn tokens(&self) -> &[String]
The normalized query tokens (length > 2, deduplicated). Used by the inverted text index to prefilter blocks before lexical scoring.
Sourcepub fn lexical_score(&self, text: &str) -> f32
pub fn lexical_score(&self, text: &str) -> f32
Lexical relevance in [0, 1].
Exact query-token coverage is dominant. A conservative prefix match helps inflected English and Hungarian words without allowing short, noisy fragments to dominate. Contiguous phrase matches break ties.
Sourcepub fn rank_distance(
&self,
text: &str,
spatial_dist_sq: f32,
keyword_boost: f32,
importance: u8,
) -> f32
pub fn rank_distance( &self, text: &str, spatial_dist_sq: f32, keyword_boost: f32, importance: u8, ) -> f32
Continuous lower-is-better rank distance.
Lexical coverage owns most of the rank, spatial distance resolves semantically comparable candidates, and importance is deliberately a small prior so it cannot rescue an unrelated memory.
Trait Implementations§
Source§impl Clone for RelevanceQuery
impl Clone for RelevanceQuery
Auto Trait Implementations§
impl Freeze for RelevanceQuery
impl RefUnwindSafe for RelevanceQuery
impl Send for RelevanceQuery
impl Sync for RelevanceQuery
impl Unpin for RelevanceQuery
impl UnsafeUnpin for RelevanceQuery
impl UnwindSafe for RelevanceQuery
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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