mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
Lowercase the facet string value
This commit is contained in:
parent
6120f6590b
commit
45877b3154
@ -237,7 +237,8 @@ impl FacetCondition {
|
|||||||
FacetType::Integer => Ok(OperatorI64(fid, Equal(pest_parse(value)?))),
|
FacetType::Integer => Ok(OperatorI64(fid, Equal(pest_parse(value)?))),
|
||||||
FacetType::Float => Ok(OperatorF64(fid, Equal(pest_parse(value)?))),
|
FacetType::Float => Ok(OperatorF64(fid, Equal(pest_parse(value)?))),
|
||||||
FacetType::String => {
|
FacetType::String => {
|
||||||
Ok(OperatorString(fid, FacetStringOperator::Equal(value.as_str().to_string())))
|
let value = value.as_str().to_lowercase().to_string();
|
||||||
|
Ok(OperatorString(fid, FacetStringOperator::Equal(value)))
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -563,7 +564,7 @@ mod tests {
|
|||||||
// Test that the facet condition is correctly generated.
|
// Test that the facet condition is correctly generated.
|
||||||
let rtxn = index.read_txn().unwrap();
|
let rtxn = index.read_txn().unwrap();
|
||||||
let condition = FacetCondition::from_str(&rtxn, &index, "channel = ponce").unwrap();
|
let condition = FacetCondition::from_str(&rtxn, &index, "channel = ponce").unwrap();
|
||||||
let expected = OperatorString(1, FacetStringOperator::Equal("ponce".into()));
|
let expected = OperatorString(1, FacetStringOperator::Equal("Ponce".into()));
|
||||||
assert_eq!(condition, expected);
|
assert_eq!(condition, expected);
|
||||||
|
|
||||||
let condition = FacetCondition::from_str(&rtxn, &index, "channel != ponce").unwrap();
|
let condition = FacetCondition::from_str(&rtxn, &index, "channel != ponce").unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user