From d9fea0143ff3d1ac4e2f4e06838cf299f5859a65 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Mon, 29 May 2023 15:51:00 +0200 Subject: [PATCH] Make Clippy happy --- meilisearch/src/routes/indexes/search.rs | 2 +- meilisearch/src/search.rs | 12 ++++++------ milli/src/search/facet/facet_distribution_iter.rs | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/meilisearch/src/routes/indexes/search.rs b/meilisearch/src/routes/indexes/search.rs index 2ee8c44f7..a25c83961 100644 --- a/meilisearch/src/routes/indexes/search.rs +++ b/meilisearch/src/routes/indexes/search.rs @@ -64,7 +64,7 @@ pub struct SearchQueryGet { show_ranking_score_details: Param, #[deserr(default, error = DeserrQueryParamError)] facets: Option>, - #[deserr(default, error = DeserrQueryParamError)] + #[deserr(default, error = DeserrQueryParamError)] // TODO sort_facet_values_by: Option, #[deserr( default = DEFAULT_HIGHLIGHT_PRE_TAG(), error = DeserrQueryParamError)] highlight_pre_tag: String, diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index 21a2a4312..6d614ad7b 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -236,17 +236,17 @@ impl From for TermsMatchingStrategy { #[derive(Debug, Default, Clone, PartialEq, Eq, Deserr)] #[deserr(rename_all = camelCase)] pub enum FacetValuesSort { - /// Facet values are sorted by decreasing count. - /// The count is the number of records containing this facet value in the results of the query. + /// Facet values are sorted in alphabetical order, ascending from A to Z. #[default] Alpha, - /// Facet values are sorted in alphabetical order, ascending from A to Z. + /// Facet values are sorted by decreasing count. + /// The count is the number of records containing this facet value in the results of the query. Count, } -impl Into for FacetValuesSort { - fn into(self) -> OrderBy { - match self { +impl From for OrderBy { + fn from(val: FacetValuesSort) -> Self { + match val { FacetValuesSort::Alpha => OrderBy::Lexicographic, FacetValuesSort::Count => OrderBy::Count, } diff --git a/milli/src/search/facet/facet_distribution_iter.rs b/milli/src/search/facet/facet_distribution_iter.rs index 9ff57b34a..475022f29 100644 --- a/milli/src/search/facet/facet_distribution_iter.rs +++ b/milli/src/search/facet/facet_distribution_iter.rs @@ -110,8 +110,7 @@ where ControlFlow::Break(_) => return Ok(()), } } else { - let starting_key = - FacetGroupKey { field_id, level: level.0 - 1, left_bound: left_bound }; + let starting_key = FacetGroupKey { field_id, level: level.0 - 1, left_bound }; for el in db.range(rtxn, &(&starting_key..)).unwrap().take(group_size as usize) { let (key, value) = el.unwrap(); // The range is unbounded on the right and the group size for the highest level is MAX,