From 6d24a4744f5a1b0f42ba2f467522d2680d9a9bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Tue, 22 Jun 2021 20:07:23 +0200 Subject: [PATCH] Roll back facetsDistribution --- meilisearch-http/src/index/search.rs | 14 +++++++------- meilisearch-http/src/routes/search.rs | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/meilisearch-http/src/index/search.rs b/meilisearch-http/src/index/search.rs index 977992deb..507273dde 100644 --- a/meilisearch-http/src/index/search.rs +++ b/meilisearch-http/src/index/search.rs @@ -49,7 +49,7 @@ pub struct SearchQuery { #[serde(default = "Default::default")] pub matches: bool, pub filter: Option, - pub facet_distributions: Option>, + pub facets_distribution: Option>, } #[derive(Debug, Clone, Serialize)] @@ -73,7 +73,7 @@ pub struct SearchResult { pub offset: usize, pub processing_time_ms: u128, #[serde(skip_serializing_if = "Option::is_none")] - pub facet_distributions: Option>>, + pub facets_distribution: Option>>, } #[derive(Copy, Clone)] @@ -198,13 +198,13 @@ impl Index { let nb_hits = candidates.len(); - let facet_distributions = match query.facet_distributions { + let facets_distribution = match query.facets_distribution { Some(ref fields) => { - let mut facet_distribution = self.facets_distribution(&rtxn); + let mut facets_distribution = self.facets_distribution(&rtxn); if fields.iter().all(|f| f != "*") { - facet_distribution.facets(fields); + facets_distribution.facets(fields); } - let distribution = facet_distribution.candidates(candidates).execute()?; + let distribution = facets_distribution.candidates(candidates).execute()?; Some(distribution) } @@ -219,7 +219,7 @@ impl Index { limit: query.limit, offset: query.offset.unwrap_or_default(), processing_time_ms: before_search.elapsed().as_millis(), - facet_distributions, + facets_distribution, }; Ok(result) } diff --git a/meilisearch-http/src/routes/search.rs b/meilisearch-http/src/routes/search.rs index e8f6bc86f..ab5a2f407 100644 --- a/meilisearch-http/src/routes/search.rs +++ b/meilisearch-http/src/routes/search.rs @@ -28,7 +28,7 @@ pub struct SearchQueryGet { filter: Option, #[serde(default = "Default::default")] matches: bool, - facet_distributions: Option, + facets_distribution: Option, } impl From for SearchQuery { @@ -45,8 +45,8 @@ impl From for SearchQuery { .attributes_to_highlight .map(|attrs| attrs.split(',').map(String::from).collect::>()); - let facet_distributions = other - .facet_distributions + let facets_distribution = other + .facets_distribution .map(|attrs| attrs.split(',').map(String::from).collect::>()); let filter = match other.filter { @@ -67,7 +67,7 @@ impl From for SearchQuery { attributes_to_highlight, filter, matches: other.matches, - facet_distributions, + facets_distribution, } } }