Resolve rule time sort criteria

This commit is contained in:
Louis Dureuil 2023-03-28 16:41:25 +02:00
parent 77acafe534
commit d4f6216966
No known key found for this signature in database

View File

@ -132,8 +132,20 @@ fn get_ranking_rules_for_placeholder_search<'ctx>(
resolve_sort_criteria(sort_criteria, ctx, &mut ranking_rules, &mut asc, &mut desc)?; resolve_sort_criteria(sort_criteria, ctx, &mut ranking_rules, &mut asc, &mut desc)?;
sort = true; sort = true;
} }
crate::Criterion::Asc(_) => todo!(), crate::Criterion::Asc(field_name) => {
crate::Criterion::Desc(_) => todo!(), if asc.contains(&field_name) {
continue;
}
asc.insert(field_name.clone());
ranking_rules.push(Box::new(Sort::new(ctx.index, ctx.txn, field_name, true)?));
}
crate::Criterion::Desc(field_name) => {
if desc.contains(&field_name) {
continue;
}
desc.insert(field_name.clone());
ranking_rules.push(Box::new(Sort::new(ctx.index, ctx.txn, field_name, false)?));
}
} }
} }
Ok(ranking_rules) Ok(ranking_rules)
@ -215,19 +227,19 @@ fn get_ranking_rules_for_query_graph_search<'ctx>(
// todo!(); // todo!();
// exactness = false; // exactness = false;
} }
crate::Criterion::Asc(field) => { crate::Criterion::Asc(field_name) => {
if asc.contains(&field) { if asc.contains(&field_name) {
continue; continue;
} }
asc.insert(field); asc.insert(field_name.clone());
// TODO ranking_rules.push(Box::new(Sort::new(ctx.index, ctx.txn, field_name, true)?));
} }
crate::Criterion::Desc(field) => { crate::Criterion::Desc(field_name) => {
if desc.contains(&field) { if desc.contains(&field_name) {
continue; continue;
} }
desc.insert(field); desc.insert(field_name.clone());
// todo!(); ranking_rules.push(Box::new(Sort::new(ctx.index, ctx.txn, field_name, false)?));
} }
} }
} }