fix(search): get sortable_fields only if criteria present

This commit is contained in:
Alexey Shekhirin 2021-08-31 21:29:58 +03:00
parent d6bba0663a
commit 0e379558a1
No known key found for this signature in database
GPG Key ID: AF9A26AA133B5B98

View File

@ -145,8 +145,8 @@ impl<'a> Search<'a> {
// We check that we are allowed to use the sort criteria, we check // We check that we are allowed to use the sort criteria, we check
// that they are declared in the sortable fields. // that they are declared in the sortable fields.
let sortable_fields = self.index.sortable_fields(self.rtxn)?;
if let Some(sort_criteria) = &self.sort_criteria { if let Some(sort_criteria) = &self.sort_criteria {
let sortable_fields = self.index.sortable_fields(self.rtxn)?;
for asc_desc in sort_criteria { for asc_desc in sort_criteria {
let field = asc_desc.field(); let field = asc_desc.field();
if !sortable_fields.contains(field) { if !sortable_fields.contains(field) {