pub struct GoldQuery {
pub query_id: String,
pub query: String,
pub relevant_docs: HashMap<String, u8>,
pub reference_answer: Option<String>,
}Expand description
A single labeled query in a retrieval dataset.
Field order is stable for downstream serialization; do not reorder without
bumping the dataset schema version in Qrels.
Fields§
§query_id: StringStable opaque identifier for the query.
query: StringNatural-language query text to send to the retriever.
relevant_docs: HashMap<String, u8>Map of doc_id -> graded_relevance. Documents not listed are treated
as non-relevant (grade 0). Grades are typically 1–3.
reference_answer: Option<String>Optional reference / “gold” answer used by answer-level evaluators. Retrieval-only metrics ignore this.
Implementations§
Source§impl GoldQuery
impl GoldQuery
Sourcepub fn is_relevant(&self, doc_id: &str) -> bool
pub fn is_relevant(&self, doc_id: &str) -> bool
Returns true if doc_id is labeled relevant (grade ≥ 1).
Sourcepub fn grade(&self, doc_id: &str) -> u8
pub fn grade(&self, doc_id: &str) -> u8
Returns the graded relevance for doc_id, or 0 if unlabeled.
Sourcepub fn relevant_count(&self) -> usize
pub fn relevant_count(&self) -> usize
Number of distinct documents labeled relevant (grade ≥ 1).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GoldQuery
impl<'de> Deserialize<'de> for GoldQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GoldQuery
impl RefUnwindSafe for GoldQuery
impl Send for GoldQuery
impl Sync for GoldQuery
impl Unpin for GoldQuery
impl UnsafeUnpin for GoldQuery
impl UnwindSafe for GoldQuery
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