Skip to content

Commit be7a7ff

Browse files
committed
Fix errors
1 parent 8479765 commit be7a7ff

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/search.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,25 @@ pub struct SearchResult<T> {
5555
/// The full result.
5656
#[serde(flatten)]
5757
pub result: T,
58+
5859
/// The formatted result.
59-
#[serde(rename = "_formatted")]
60+
#[serde(rename = "_formatted", skip_serializing_if = "Option::is_none")]
6061
pub formatted_result: Option<Map<String, Value>>,
62+
6163
/// The object that contains information about the matches.
62-
#[serde(rename = "_matchesPosition")]
64+
#[serde(rename = "_matchesPosition", skip_serializing_if = "Option::is_none")]
6365
pub matches_position: Option<HashMap<String, Vec<MatchRange>>>,
66+
6467
/// The relevancy score of the match.
65-
#[serde(rename = "_rankingScore")]
68+
#[serde(rename = "_rankingScore", skip_serializing_if = "Option::is_none")]
6669
pub ranking_score: Option<f64>,
67-
#[serde(rename = "_rankingScoreDetails")]
70+
71+
/// A detailed global ranking score field
72+
#[serde(rename = "_rankingScoreDetails", skip_serializing_if = "Option::is_none")]
6873
pub ranking_score_details: Option<Map<String, Value>>,
74+
6975
/// Only returned for federated multi search.
70-
#[serde(rename = "_federation")]
76+
#[serde(rename = "_federation", skip_serializing_if = "Option::is_none")]
7177
pub federation: Option<FederationHitInfo>,
7278
}
7379

@@ -832,7 +838,7 @@ pub struct FederatedMultiSearchResponse<T> {
832838
}
833839

834840
/// Returned for each hit in `_federation` when doing federated multi search.
835-
#[derive(Debug, Deserialize, Clone)]
841+
#[derive(Serialize, Deserialize, Debug, Clone)]
836842
#[serde(rename_all = "camelCase")]
837843
pub struct FederationHitInfo {
838844
pub index_uid: String,
@@ -1243,6 +1249,7 @@ mod tests {
12431249
number: 90,
12441250
value: S("Harry Potter and the Deathly Hallows"),
12451251
nested: Nested { child: S("tenth") },
1252+
_vectors: None,
12461253
})
12471254
);
12481255
assert_eq!(

0 commit comments

Comments
 (0)