From 54d5cec582ccb9759f6cc36c30fbe3083eefa58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 23 Nov 2020 15:13:47 +0100 Subject: [PATCH] Transform numbers into strings when faceted and necessary --- src/update/index_documents/store.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/update/index_documents/store.rs b/src/update/index_documents/store.rs index 6fb07b345..25c343910 100644 --- a/src/update/index_documents/store.rs +++ b/src/update/index_documents/store.rs @@ -571,7 +571,10 @@ fn parse_facet_value(ftype: FacetType, value: &Value) -> anyhow::Result Ok(()), Value::Bool(b) => Ok(output.push(Integer(*b as i64))), Value::Number(number) => match ftype { - FacetType::String => bail!("invalid facet type, expecting {} found number", ftype), + FacetType::String => { + let string = SmallString32::from(number.to_string()); + Ok(output.push(String(string))) + }, FacetType::Float => match number.as_f64() { Some(float) => Ok(output.push(Float(OrderedFloat(float)))), None => bail!("invalid facet type, expecting {} found integer", ftype),