Introduce the new SortRankingRuleMissing user error variant

This commit is contained in:
Kerollmops 2021-09-07 10:37:57 +02:00
parent 446ed17589
commit 8dca36433c
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -59,6 +59,7 @@ pub enum UserError {
InvalidFilter(pest::error::Error<ParserRule>),
InvalidFilterAttribute(pest::error::Error<ParserRule>),
InvalidSortableAttribute { field: String, valid_fields: HashSet<String> },
SortRankingRuleMissing,
InvalidStoreFile,
MaxDatabaseSizeReached,
MissingDocumentId { document: Object },
@ -236,6 +237,10 @@ only composed of alphanumeric characters (a-z A-Z 0-9), hyphens (-) and undersco
field, valid_names
)
}
Self::SortRankingRuleMissing => f.write_str(
"The sort ranking rule must be specified in the \
ranking rules settings to use the sort parameter at search time",
),
Self::MissingDocumentId { document } => {
let json = serde_json::to_string(document).unwrap();
write!(f, "document doesn't have an identifier {}", json)