couchbase_core/searchx/
search_result.rs1use chrono::{DateTime, FixedOffset};
20use serde_json::value::RawValue;
21use std::collections::HashMap;
22use std::hash::Hash;
23use std::time::Duration;
24
25#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
26pub struct HitLocation {
27 pub start: u32,
28 pub end: u32,
29 pub position: u32,
30 pub array_positions: Option<Vec<u32>>,
31}
32
33#[derive(Debug, Clone)]
34pub struct ResultHit {
35 pub index: String,
36 pub id: String,
37 pub score: f64,
38 pub locations: Option<HashMap<String, HashMap<String, Vec<HitLocation>>>>,
39 pub fragments: Option<HashMap<String, Vec<String>>>,
40 pub fields: Option<Box<RawValue>>,
41 pub explanation: Option<Box<RawValue>>,
42}
43
44#[derive(Debug, Clone, PartialEq)]
45pub struct MetaData {
46 pub errors: HashMap<String, String>,
47 pub metrics: Metrics,
48}
49
50#[derive(Debug, Clone, PartialOrd, PartialEq)]
51pub struct Metrics {
52 pub failed_partition_count: u64,
53 pub max_score: f64,
54 pub successful_partition_count: u64,
55 pub took: Duration,
56 pub total_hits: u64,
57 pub total_partition_count: u64,
58}
59
60#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
61pub struct TermFacetResult {
62 pub term: String,
63 pub count: i64,
64}
65
66#[derive(Debug, Clone, PartialOrd, PartialEq)]
67pub struct NumericRangeFacetResult {
68 pub name: String,
69 pub min: f64,
70 pub max: f64,
71 pub count: i64,
72}
73
74#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
75pub struct DateRangeFacetResult {
76 pub name: String,
77 pub start: DateTime<FixedOffset>,
78 pub end: DateTime<FixedOffset>,
79 pub count: i64,
80}
81
82#[derive(Debug, Clone, PartialOrd, PartialEq)]
83pub struct FacetResult {
84 pub field: String,
85 pub total: i64,
86 pub missing: i64,
87 pub other: i64,
88 pub terms: Option<Vec<TermFacetResult>>,
89 pub numeric_ranges: Option<Vec<NumericRangeFacetResult>>,
90 pub date_ranges: Option<Vec<DateRangeFacetResult>>,
91}