Skip to content

Commit fdaef5a

Browse files
committed
Update a lot of stuff that changed
1 parent 9bca8cc commit fdaef5a

File tree

1 file changed

+29
-8
lines changed

1 file changed

+29
-8
lines changed

src/search.rs

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{
2-
client::Client, errors::Error, indexes::Index, request::HttpClient, DefaultHttpClient,
2+
client::Client, errors::{Error, MeilisearchError}, indexes::Index, request::HttpClient, DefaultHttpClient,
33
};
44
use either::Either;
55
use serde::{de::DeserializeOwned, Deserialize, Serialize, Serializer};
@@ -822,37 +822,58 @@ impl<'a, Http: HttpClient> FederatedMultiSearchQuery<'a, '_, Http> {
822822
}
823823
}
824824

825+
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
826+
pub struct ComputedFacets {
827+
pub distribution: HashMap<String, HashMap<String, u64>>,
828+
pub stats: HashMap<String, FacetStats>,
829+
}
830+
825831
/// Returned by federated multi search.
826832
#[derive(Debug, Deserialize, Clone)]
827833
#[serde(rename_all = "camelCase")]
828834
pub struct FederatedMultiSearchResponse<T> {
829835
/// Merged results of the query.
830836
pub hits: Vec<SearchResult<T>>,
831837

832-
// TODO: are offset, limit and estimated_total_hits really non-optional? In
833-
// my tests they are always returned, but that's not a proof.
834838
/// Number of documents skipped.
835839
pub offset: usize,
840+
836841
/// Number of results returned.
837842
pub limit: usize,
843+
838844
/// Estimated total number of matches.
839845
pub estimated_total_hits: usize,
840846

841-
/// Distribution of the given facets.
842-
pub facet_distribution: Option<HashMap<String, HashMap<String, usize>>>,
843-
/// facet stats of the numerical facets requested in the `facet` search parameter.
844-
pub facet_stats: Option<HashMap<String, FacetStats>>,
845847
/// Processing time of the query.
846848
pub processing_time_ms: usize,
849+
850+
/// [Data for facets present in the search results](https://www.meilisearch.com/docs/reference/api/multi_search#facetsbyindex)
851+
pub facets_by_index: Option<ComputedFacets>,
852+
853+
/// [Distribution of the given facets](https://www.meilisearch.com/docs/reference/api/multi_search#mergefacets)
854+
pub facet_distribution: Option<HashMap<String, HashMap<String, usize>>>,
855+
856+
/// [The numeric `min` and `max` values per facet](https://www.meilisearch.com/docs/reference/api/multi_search#mergefacets)
857+
pub facet_stats: Option<HashMap<String, FacetStats>>,
858+
859+
/// Indicates which remote requests failed and why
860+
pub remote_errors: Option<HashMap<String, MeilisearchError>>,
847861
}
848862

849863
/// Returned for each hit in `_federation` when doing federated multi search.
850864
#[derive(Serialize, Deserialize, Debug, Clone)]
851865
#[serde(rename_all = "camelCase")]
852866
pub struct FederationHitInfo {
867+
/// Index of origin for this document
853868
pub index_uid: String,
869+
870+
/// Array index number of the query in the request’s queries array
854871
pub queries_position: usize,
855-
// TOOD: not mentioned in the docs, is that optional?
872+
873+
/// Remote instance of origin for this document
874+
pub remote: Option<String>,
875+
876+
/// The product of the _rankingScore of the hit and the weight of the query of origin.
856877
pub weighted_ranking_score: f32,
857878
}
858879

0 commit comments

Comments
 (0)