mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 11:57:07 +02:00
Change documents routes; fix #416
This commit is contained in:
parent
a5c5df0290
commit
f0590d3301
4 changed files with 24 additions and 8 deletions
|
@ -23,7 +23,13 @@ pub fn value_to_string(value: &Value) -> Option<String> {
|
|||
Value::Null => None,
|
||||
Value::Bool(_) => None,
|
||||
Value::Number(value) => Some(value.to_string()),
|
||||
Value::String(value) => Some(value.to_string()),
|
||||
Value::String(value) => {
|
||||
if value.chars().all(|x| x.is_ascii_alphanumeric() || x == '-' || x == '_') {
|
||||
Some(value.to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
Value::Array(_) => None,
|
||||
Value::Object(_) => None,
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ impl fmt::Display for SerializerError {
|
|||
f.write_str("serialized document does not have an id according to the schema")
|
||||
}
|
||||
SerializerError::InvalidDocumentIdType => {
|
||||
f.write_str("document identifier can only be of type string or number")
|
||||
f.write_str("document identifier can only be of type number or string (A-Z, a-z, 0-9, -_)")
|
||||
}
|
||||
SerializerError::Zlmdb(e) => write!(f, "heed related error: {}", e),
|
||||
SerializerError::SerdeJson(e) => write!(f, "serde json error: {}", e),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue