pub struct DocMeta {
pub document_sets: Vec<String>,
pub boost: f32,
pub metadata: HashMap<String, String>,
}Expand description
Curation metadata recorded for a stored document: its document-set
membership and its retrieval boost, plus the raw metadata map so the
RetrievalFilter’s metadata_eq equalities can be evaluated at read.
Parsed from a Document’s metadata at ingest by DocMeta::from_document.
Fields§
§document_sets: Vec<String>The named sets this document belongs to (parsed from the comma-separated
document_set metadata value; empty when the document is in no set).
boost: f32The retrieval boost multiplier (parsed from the boost metadata value;
DEFAULT_BOOST when absent/malformed). Clamped to ≥ 0.0.
metadata: HashMap<String, String>The full stamped metadata map, retained so metadata_eq filters can test
arbitrary key/value equalities against it.
Implementations§
Source§impl DocMeta
impl DocMeta
Sourcepub const DOCUMENT_SET_KEY: &'static str = "document_set"
pub const DOCUMENT_SET_KEY: &'static str = "document_set"
The document-metadata key under which set membership is stamped. The
value is a comma-separated list (e.g. "alpha" or "alpha,beta").
Sourcepub const BOOST_KEY: &'static str = "boost"
pub const BOOST_KEY: &'static str = "boost"
The document-metadata key under which the numeric boost is stamped (a
stringified f32, e.g. "3.0").
Sourcepub fn parse_sets(metadata: &HashMap<String, String>) -> Vec<String>
pub fn parse_sets(metadata: &HashMap<String, String>) -> Vec<String>
Parse the document-set list from a document_set metadata value:
comma-split, trim each name, drop empties. Returns an empty vec when the
key is absent or holds only whitespace/commas.
Sourcepub fn parse_boost(metadata: &HashMap<String, String>) -> f32
pub fn parse_boost(metadata: &HashMap<String, String>) -> f32
Parse the boost from a boost metadata value. Absent / unparseable /
non-finite ⇒ DEFAULT_BOOST; a parsed value is clamped to ≥ 0.0 so a
negative boost can only bury a document, never invert ordering.
Sourcepub fn from_metadata(metadata: &HashMap<String, String>) -> Self
pub fn from_metadata(metadata: &HashMap<String, String>) -> Self
Build a DocMeta from a stored document’s metadata.
Sourcepub fn from_document(doc: &Document) -> Self
pub fn from_document(doc: &Document) -> Self
Build a DocMeta from a Document (convenience over
from_metadata).
Trait Implementations§
impl StructuralPartialEq for DocMeta
Auto Trait Implementations§
impl Freeze for DocMeta
impl RefUnwindSafe for DocMeta
impl Send for DocMeta
impl Sync for DocMeta
impl Unpin for DocMeta
impl UnsafeUnpin for DocMeta
impl UnwindSafe for DocMeta
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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