fix the error code in case of not filterable attributes on the get / delete documents by filter routes

This commit is contained in:
Tamo 2023-05-16 13:56:18 +02:00
parent 0b38f211ac
commit 96da5130a4
No known key found for this signature in database
GPG key ID: 20CD8020AFA88D69
4 changed files with 50 additions and 8 deletions

View file

@ -540,7 +540,12 @@ fn retrieve_documents<S: AsRef<str>>(
};
let candidates = if let Some(filter) = filter {
filter.evaluate(&rtxn, index)?
filter.evaluate(&rtxn, index).map_err(|err| match err {
milli::Error::UserError(milli::UserError::InvalidFilter(_)) => {
ResponseError::from_msg(err.to_string(), Code::InvalidDocumentFilter)
}
e => e.into(),
})?
} else {
index.documents_ids(&rtxn)?
};