This commit is contained in:
Tamo 2021-09-01 17:03:42 +02:00
parent aca707413c
commit b1bf7d4f40
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -18,10 +18,10 @@ use crate::search::{word_derivations, WordDerivationsCache};
use crate::{DocumentId, FieldId, Index, Result, TreeLevel}; use crate::{DocumentId, FieldId, Index, Result, TreeLevel};
mod asc_desc; mod asc_desc;
mod geo;
mod attribute; mod attribute;
mod exactness; mod exactness;
pub mod r#final; pub mod r#final;
mod geo;
mod initial; mod initial;
mod proximity; mod proximity;
mod typo; mod typo;
@ -292,25 +292,24 @@ impl<'t> CriteriaBuilder<'t> {
Some(ref sort_criteria) => { Some(ref sort_criteria) => {
for asc_desc in sort_criteria { for asc_desc in sort_criteria {
criterion = match asc_desc { criterion = match asc_desc {
AscDescName::Asc(Member::Field(field)) => { AscDescName::Asc(Member::Field(field)) => Box::new(AscDesc::asc(
Box::new(AscDesc::asc( &self.index,
&self.index, &self.rtxn,
&self.rtxn, criterion,
criterion, field.to_string(),
field.to_string(), )?),
)?) AscDescName::Desc(Member::Field(field)) => Box::new(AscDesc::desc(
} &self.index,
AscDescName::Desc(Member::Field(field)) => { &self.rtxn,
Box::new(AscDesc::desc( criterion,
&self.index, field.to_string(),
&self.rtxn, )?),
criterion, AscDescName::Asc(Member::Geo(point)) => Box::new(Geo::new(
field.to_string(), &self.index,
)?) &self.rtxn,
} criterion,
AscDescName::Asc(Member::Geo(point)) => { point.clone(),
Box::new(Geo::new(&self.index, &self.rtxn, criterion, point.clone())?) )?),
}
AscDescName::Desc(Member::Geo(_point)) => { AscDescName::Desc(Member::Geo(_point)) => {
panic!("You can't desc geosort"); // TODO: TAMO: remove this panic!("You can't desc geosort"); // TODO: TAMO: remove this
} }