Skip to content

Serialize for MultiSearchResponse #668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{de::DeserializeOwned, ser::SerializeStruct, Deserialize, Serialize,
use serde_json::{Map, Value};
use std::collections::HashMap;

#[derive(Deserialize, Debug, Eq, PartialEq, Clone)]
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct MatchRange {
pub start: usize,
pub length: usize,
Expand Down Expand Up @@ -50,7 +50,7 @@ pub enum MatchingStrategies {
/// A single result.
///
/// Contains the complete object, optionally the formatted object, and optionally an object that contains information about the matches.
#[derive(Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct SearchResult<T> {
/// The full result.
#[serde(flatten)]
Expand All @@ -68,14 +68,14 @@ pub struct SearchResult<T> {
pub ranking_score_details: Option<Map<String, Value>>,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
pub struct FacetStats {
pub min: f64,
pub max: f64,
}

#[derive(Deserialize, Debug, Clone)]
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "camelCase")]
/// A struct containing search results and other information about the search.
pub struct SearchResults<T> {
Expand Down Expand Up @@ -657,7 +657,7 @@ impl<'a, 'b, Http: HttpClient> MultiSearchQuery<'a, 'b, Http> {
self.client.execute_multi_search_query::<T>(self).await
}
}
#[derive(Debug, Clone, Deserialize)]
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct MultiSearchResponse<T> {
pub results: Vec<SearchResults<T>>,
}
Expand Down