mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
craft an API over the Shared Server and Shared index to avoid hard to debug mistakes
This commit is contained in:
parent
ed795bc837
commit
d262b1df32
9 changed files with 668 additions and 546 deletions
|
@ -75,25 +75,21 @@ impl<'a> Display for FilterError<'a> {
|
|||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::AttributeNotFilterable { attribute, filterable_fields } => {
|
||||
write!(f, "Attribute `{attribute}` is not filterable.")?;
|
||||
if filterable_fields.is_empty() {
|
||||
write!(
|
||||
f,
|
||||
"Attribute `{}` is not filterable. This index does not have configured filterable attributes.",
|
||||
attribute,
|
||||
)
|
||||
write!(f, " This index does not have configured filterable attributes.")
|
||||
} else {
|
||||
let filterables_list = filterable_fields
|
||||
.iter()
|
||||
.map(AsRef::as_ref)
|
||||
.collect::<Vec<&str>>()
|
||||
.join(" ");
|
||||
|
||||
write!(
|
||||
f,
|
||||
"Attribute `{}` is not filterable. Available filterable attributes are: `{}`.",
|
||||
attribute,
|
||||
filterables_list,
|
||||
)
|
||||
write!(f, " Available filterable attributes are: ")?;
|
||||
let mut filterables_list =
|
||||
filterable_fields.iter().map(AsRef::as_ref).collect::<Vec<&str>>();
|
||||
filterables_list.sort_unstable();
|
||||
for (idx, filterable) in filterables_list.iter().enumerate() {
|
||||
write!(f, "`{filterable}`")?;
|
||||
if idx != filterables_list.len() - 1 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
}
|
||||
write!(f, ".")
|
||||
}
|
||||
}
|
||||
Self::TooDeep => write!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue