pub struct CachedSearchResult {
pub query_hash: u64,
pub query_embedding: Option<Vec<f32>>,
pub filter_params: CacheFilterParams,
pub results: Vec<SearchResult>,
pub created_at: Instant,
pub hit_count: AtomicU64,
pub feedback_score: AtomicI64,
}Expand description
A cached search result entry
Fields§
§query_hash: u64Hash of the original query
query_embedding: Option<Vec<f32>>The query embedding (for similarity matching)
filter_params: CacheFilterParamsFilter parameters used for this search
results: Vec<SearchResult>The cached results
created_at: InstantWhen this entry was created
hit_count: AtomicU64Number of times this cache entry was hit
feedback_score: AtomicI64Feedback score (positive = good results, negative = bad)
Implementations§
Source§impl CachedSearchResult
impl CachedSearchResult
pub fn new( query_hash: u64, query_embedding: Option<Vec<f32>>, filter_params: CacheFilterParams, results: Vec<SearchResult>, ) -> Self
Sourcepub fn is_expired(&self, ttl: Duration) -> bool
pub fn is_expired(&self, ttl: Duration) -> bool
Check if this entry is expired
Sourcepub fn record_hit(&self)
pub fn record_hit(&self)
Record a cache hit
Sourcepub fn record_feedback(&self, positive: bool)
pub fn record_feedback(&self, positive: bool)
Record feedback (positive or negative)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CachedSearchResult
impl RefUnwindSafe for CachedSearchResult
impl Send for CachedSearchResult
impl Sync for CachedSearchResult
impl Unpin for CachedSearchResult
impl UnsafeUnpin for CachedSearchResult
impl UnwindSafe for CachedSearchResult
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> 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 moreCreates a shared type from an unshared type.