1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use super::{Hit, TotalHits};
use crate::util::ShouldSkip;

/// Matched hits
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct HitsMetadata {
    /// Total number of matched documents
    #[serde(skip_serializing_if = "ShouldSkip::should_skip")]
    pub total: Option<TotalHits>,

    /// Maximum document score. [`None`] when documents are implicitly sorted
    /// by a field other than `_score`
    #[serde(skip_serializing_if = "ShouldSkip::should_skip")]
    pub max_score: Option<f32>,

    /// Matched hits
    #[serde(default = "Vec::new")]
    pub hits: Vec<Hit>,
}