Apply suggestions from code review

This commit is contained in:
Tamo 2025-04-15 14:43:07 +02:00 committed by GitHub
parent fd7fbfa9eb
commit 55adbac2dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 9 deletions

View File

@ -40,7 +40,6 @@ fn facet_number_values<'a>(
}
#[derive(Debug, Clone, Copy)]
pub struct Parameter {
// Define the strategy used by the geo sort
pub strategy: Strategy,
@ -107,7 +106,7 @@ pub struct GeoSort<Q: RankingRuleQueryTrait> {
impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
pub fn new(
parameter: &Parameter,
parameter: Parameter,
geo_faceted_docids: RoaringBitmap,
point: [f64; 2],
ascending: bool,
@ -115,15 +114,15 @@ impl<Q: RankingRuleQueryTrait> GeoSort<Q> {
let Parameter { strategy, max_bucket_size, distance_error_margin } = parameter;
Ok(Self {
query: None,
strategy: *strategy,
strategy,
ascending,
point,
geo_candidates: geo_faceted_docids,
field_ids: None,
rtree: None,
cached_sorted_docids: VecDeque::new(),
max_bucket_size: *max_bucket_size,
distance_error_margin: *distance_error_margin,
max_bucket_size,
distance_error_margin,
})
}

View File

@ -300,7 +300,7 @@ fn get_ranking_rules_for_placeholder_search<'ctx>(
&mut ranking_rules,
&mut sorted_fields,
&mut geo_sorted,
&geo_param,
geo_param,
)?;
sort = true;
}
@ -376,7 +376,7 @@ fn get_ranking_rules_for_vector<'ctx>(
&mut ranking_rules,
&mut sorted_fields,
&mut geo_sorted,
&geo_param,
geo_param,
)?;
sort = true;
}
@ -478,7 +478,7 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
&mut ranking_rules,
&mut sorted_fields,
&mut geo_sorted,
&geo_param,
geo_param,
)?;
sort = true;
}
@ -515,7 +515,7 @@ fn resolve_sort_criteria<'ctx, Query: RankingRuleQueryTrait>(
ranking_rules: &mut Vec<BoxRankingRule<'ctx, Query>>,
sorted_fields: &mut HashSet<String>,
geo_sorted: &mut bool,
geo_param: &geo_sort::Parameter,
geo_param: geo_sort::Parameter,
) -> Result<()> {
let sort_criteria = sort_criteria.clone().unwrap_or_default();
ranking_rules.reserve(sort_criteria.len());