mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
Apply suggestions from code review
This commit is contained in:
parent
fd7fbfa9eb
commit
55adbac2dd
2 changed files with 8 additions and 9 deletions
|
@ -40,7 +40,6 @@ fn facet_number_values<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
|
|
||||||
pub struct Parameter {
|
pub struct Parameter {
|
||||||
// Define the strategy used by the geo sort
|
// Define the strategy used by the geo sort
|
||||||
pub strategy: Strategy,
|
pub strategy: Strategy,
|
||||||
|
@ -107,7 +106,7 @@ pub struct GeoSort<Q: RankingRuleQueryTrait> {
|
||||||
|
|
||||||
impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
|
impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
parameter: &Parameter,
|
parameter: Parameter,
|
||||||
geo_faceted_docids: RoaringBitmap,
|
geo_faceted_docids: RoaringBitmap,
|
||||||
point: [f64; 2],
|
point: [f64; 2],
|
||||||
ascending: bool,
|
ascending: bool,
|
||||||
|
@ -115,15 +114,15 @@ impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
|
||||||
let Parameter { strategy, max_bucket_size, distance_error_margin } = parameter;
|
let Parameter { strategy, max_bucket_size, distance_error_margin } = parameter;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
query: None,
|
query: None,
|
||||||
strategy: *strategy,
|
strategy,
|
||||||
ascending,
|
ascending,
|
||||||
point,
|
point,
|
||||||
geo_candidates: geo_faceted_docids,
|
geo_candidates: geo_faceted_docids,
|
||||||
field_ids: None,
|
field_ids: None,
|
||||||
rtree: None,
|
rtree: None,
|
||||||
cached_sorted_docids: VecDeque::new(),
|
cached_sorted_docids: VecDeque::new(),
|
||||||
max_bucket_size: *max_bucket_size,
|
max_bucket_size,
|
||||||
distance_error_margin: *distance_error_margin,
|
distance_error_margin,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ fn get_ranking_rules_for_placeholder_search<'ctx>(
|
||||||
&mut ranking_rules,
|
&mut ranking_rules,
|
||||||
&mut sorted_fields,
|
&mut sorted_fields,
|
||||||
&mut geo_sorted,
|
&mut geo_sorted,
|
||||||
&geo_param,
|
geo_param,
|
||||||
)?;
|
)?;
|
||||||
sort = true;
|
sort = true;
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ fn get_ranking_rules_for_vector<'ctx>(
|
||||||
&mut ranking_rules,
|
&mut ranking_rules,
|
||||||
&mut sorted_fields,
|
&mut sorted_fields,
|
||||||
&mut geo_sorted,
|
&mut geo_sorted,
|
||||||
&geo_param,
|
geo_param,
|
||||||
)?;
|
)?;
|
||||||
sort = true;
|
sort = true;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +478,7 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
|
||||||
&mut ranking_rules,
|
&mut ranking_rules,
|
||||||
&mut sorted_fields,
|
&mut sorted_fields,
|
||||||
&mut geo_sorted,
|
&mut geo_sorted,
|
||||||
&geo_param,
|
geo_param,
|
||||||
)?;
|
)?;
|
||||||
sort = true;
|
sort = true;
|
||||||
}
|
}
|
||||||
|
@ -515,7 +515,7 @@ fn resolve_sort_criteria<'ctx, Query: RankingRuleQueryTrait>(
|
||||||
ranking_rules: &mut Vec<BoxRankingRule<'ctx, Query>>,
|
ranking_rules: &mut Vec<BoxRankingRule<'ctx, Query>>,
|
||||||
sorted_fields: &mut HashSet<String>,
|
sorted_fields: &mut HashSet<String>,
|
||||||
geo_sorted: &mut bool,
|
geo_sorted: &mut bool,
|
||||||
geo_param: &geo_sort::Parameter,
|
geo_param: geo_sort::Parameter,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let sort_criteria = sort_criteria.clone().unwrap_or_default();
|
let sort_criteria = sort_criteria.clone().unwrap_or_default();
|
||||||
ranking_rules.reserve(sort_criteria.len());
|
ranking_rules.reserve(sort_criteria.len());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue