pub struct SearchResult {
pub chunk: ChunkSummary,
pub score: f32,
}Expand description
A code chunk search result with similarity score. A search result with similarity score.
Serialization uses explicit to_json() / to_json_relative() methods instead of
derive(Serialize) to produce a lean, stable field set: only user-visible fields
are included, with has_parent (bool) instead of raw parent_id (Option
Fields§
§chunk: ChunkSummaryThe matching chunk
score: f32Similarity score (0.0 to 1.0, higher is better)
Implementations§
Source§impl SearchResult
impl SearchResult
Sourcepub fn to_json(&self) -> Value
pub fn to_json(&self) -> Value
Serialize to JSON with consistent field order and platform-normalized paths.
Normalizes file paths to forward slashes for cross-platform consistency. Includes all chunk metadata plus score.
Sourcepub fn to_json_relative(&self, root: &Path) -> Value
pub fn to_json_relative(&self, root: &Path) -> Value
Serialize to JSON with file paths relative to a project root.
Strips the prefix and normalizes to forward slashes.
Trait Implementations§
Source§impl Clone for SearchResult
impl Clone for SearchResult
Source§fn clone(&self) -> SearchResult
fn clone(&self) -> SearchResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SearchResult
impl RefUnwindSafe for SearchResult
impl Send for SearchResult
impl Sync for SearchResult
impl Unpin for SearchResult
impl UnsafeUnpin for SearchResult
impl UnwindSafe for SearchResult
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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