pub struct RerankedDocument {
pub document: Document,
pub rerank_score: f32,
}Expand description
One reranked document paired with the score the Reranker assigned.
Two scores ride together: the inner Document::score carries the
original retrieval score from the VectorStore (or None if the
store did not surface one), and rerank_score carries the reranker’s
own score. Keeping them distinct preserves explainability — UIs and
dashboards can show “the embedding ranked this 0.82, the cross-encoder
ranked it 0.41 → moved from rank 1 to rank 7” without ambiguity, and
downstream filters can threshold on whichever score the deployment
trusts.
Fields§
§document: DocumentThe reranked document. Its score field still holds the
retrieval score from the originating VectorStore — the
reranker does not mutate it.
rerank_score: f32The reranker’s score for this document at this query. Comparable only within a single rerank call. Higher = better per the reranker’s scoring model.
Implementations§
Source§impl RerankedDocument
impl RerankedDocument
Sourcepub const fn new(document: Document, rerank_score: f32) -> RerankedDocument
pub const fn new(document: Document, rerank_score: f32) -> RerankedDocument
Build a reranked document from a candidate and a fresh score.
Trait Implementations§
Source§impl Clone for RerankedDocument
impl Clone for RerankedDocument
Source§fn clone(&self) -> RerankedDocument
fn clone(&self) -> RerankedDocument
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RerankedDocument
impl Debug for RerankedDocument
Source§impl<'de> Deserialize<'de> for RerankedDocument
impl<'de> Deserialize<'de> for RerankedDocument
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<RerankedDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<RerankedDocument, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for RerankedDocument
impl PartialEq for RerankedDocument
Source§fn eq(&self, other: &RerankedDocument) -> bool
fn eq(&self, other: &RerankedDocument) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RerankedDocument
impl Serialize for RerankedDocument
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for RerankedDocument
Auto Trait Implementations§
impl Freeze for RerankedDocument
impl RefUnwindSafe for RerankedDocument
impl Send for RerankedDocument
impl Sync for RerankedDocument
impl Unpin for RerankedDocument
impl UnsafeUnpin for RerankedDocument
impl UnwindSafe for RerankedDocument
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<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
impl<D> DeserializeWith<JsonFormat> for Dwhere
D: DeserializeOwned,
Source§fn deserialize_with(body: ResponseBody) -> Result<D, Error>
fn deserialize_with(body: ResponseBody) -> Result<D, Error>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request