From b15c77ebc4608953e3009e99c9b2be8aaac84d1a Mon Sep 17 00:00:00 2001 From: Tamo Date: Wed, 8 Sep 2021 18:08:51 +0200 Subject: [PATCH] return an error in case a user try to sort with :desc --- milli/src/search/criteria/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/search/criteria/mod.rs b/milli/src/search/criteria/mod.rs index 782fedcc8..fca159900 100644 --- a/milli/src/search/criteria/mod.rs +++ b/milli/src/search/criteria/mod.rs @@ -15,7 +15,7 @@ use super::query_tree::{Operation, PrimitiveQueryPart, Query, QueryKind}; use crate::criterion::{AscDesc as AscDescName, Member}; use crate::search::criteria::geo::Geo; 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 attribute; @@ -311,7 +311,7 @@ impl<'t> CriteriaBuilder<'t> { point.clone(), )?), 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() })? } }; }