return an error in case a user try to sort with :desc

This commit is contained in:
Tamo 2021-09-08 18:08:51 +02:00
parent 4b618b95e4
commit b15c77ebc4
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -15,7 +15,7 @@ use super::query_tree::{Operation, PrimitiveQueryPart, Query, QueryKind};
use crate::criterion::{AscDesc as AscDescName, Member}; use crate::criterion::{AscDesc as AscDescName, Member};
use crate::search::criteria::geo::Geo; use crate::search::criteria::geo::Geo;
use crate::search::{word_derivations, WordDerivationsCache}; use crate::search::{word_derivations, WordDerivationsCache};
use crate::{DocumentId, FieldId, Index, Result, TreeLevel}; use crate::{DocumentId, FieldId, Index, Result, TreeLevel, UserError};
mod asc_desc; mod asc_desc;
mod attribute; mod attribute;
@ -311,7 +311,7 @@ impl<'t> CriteriaBuilder<'t> {
point.clone(), point.clone(),
)?), )?),
AscDescName::Desc(Member::Geo(_point)) => { AscDescName::Desc(Member::Geo(_point)) => {
panic!("You can't desc geosort"); // TODO: TAMO: remove this return Err(UserError::InvalidSortName { name: "Sorting in descending order is currently not supported for the geosearch".to_string() })?
} }
}; };
} }