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