pub struct RelevanceTracker { /* private fields */ }Expand description
The relevance tracker maintains a keyword index of all compressed content.
Implementations§
Source§impl RelevanceTracker
impl RelevanceTracker
pub fn new() -> Self
pub fn with_config(budget_tokens: usize, threshold: f64) -> Self
pub fn with_config_and_age( budget_tokens: usize, threshold: f64, max_age_secs: u64, ) -> Self
Sourcepub fn configure(
&mut self,
budget_tokens: usize,
threshold: f64,
max_age_secs: u64,
)
pub fn configure( &mut self, budget_tokens: usize, threshold: f64, max_age_secs: u64, )
Update runtime settings without discarding already indexed entries.
Sourcepub fn register(
&mut self,
handle: String,
original_content: &str,
source_tool: &'static str,
original_tokens: usize,
compressed_tokens: usize,
)
pub fn register( &mut self, handle: String, original_content: &str, source_tool: &'static str, original_tokens: usize, compressed_tokens: usize, )
Register a new compressed content entry with extracted keywords.
Sourcepub fn register_at(
&mut self,
handle: String,
original_content: &str,
source_tool: &'static str,
original_tokens: usize,
compressed_tokens: usize,
timestamp: u64,
)
pub fn register_at( &mut self, handle: String, original_content: &str, source_tool: &'static str, original_tokens: usize, compressed_tokens: usize, timestamp: u64, )
Register content with an explicit timestamp for deterministic tests and replayed session state.
Sourcepub fn disable_handle(&mut self, handle: &str)
pub fn disable_handle(&mut self, handle: &str)
Stop proactive expansion for one archive after a caller reports a bounce.
Sourcepub fn find_matches(&self, query_context: &str) -> Vec<ExpansionMatch>
pub fn find_matches(&self, query_context: &str) -> Vec<ExpansionMatch>
Find entries matching the current query context. Returns matches sorted by score (highest first), within the token budget.
Sourcepub fn expand_if_relevant(&self, query_context: &str) -> Option<String>
pub fn expand_if_relevant(&self, query_context: &str) -> Option<String>
Check if proactive expansion should trigger for a given context. Returns the formatted expansion block if matches found.
Trait Implementations§
Auto Trait Implementations§
impl Forget for RelevanceTracker
impl Freeze for RelevanceTrackerwhere
*const u8 is !null: Freeze,
PhantomData<CompressedContentEntry>: Freeze,
*const LeafNode<String, SetValZST> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, SetValZST)>>: Freeze,
impl Move for RelevanceTracker
impl RefUnwindSafe for RelevanceTracker
impl Send for RelevanceTracker
impl Sync for RelevanceTracker
impl Unpin for RelevanceTracker
impl UnsafeUnpin for RelevanceTrackerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<CompressedContentEntry>: UnsafeUnpin,
*const LeafNode<String, SetValZST> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, SetValZST)>>: UnsafeUnpin,
impl UnwindSafe for RelevanceTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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