mirror of
https://github.com/qdrant/qdrant.git
synced 2026-08-06 10:00:58 -05:00
Restore is empty functions as before (#1657)
* is_empty should match with value=null * fmt
This commit is contained in:
@@ -72,15 +72,24 @@ impl MultiValue<&Value> {
|
||||
Self::Single(val) => match val {
|
||||
None => true,
|
||||
Some(Value::Array(vec)) => vec.is_empty(),
|
||||
Some(Value::Null) => true,
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
pub(crate) fn check_is_null(&self) -> bool {
|
||||
if let Self::Single(Some(val)) = self {
|
||||
return val.is_null();
|
||||
match self {
|
||||
MultiValue::Single(val) => {
|
||||
if let Some(val) = val {
|
||||
return val.is_null();
|
||||
}
|
||||
false
|
||||
}
|
||||
// { "a": [ { "b": null }, { "b": 1 } ] } => true
|
||||
// { "a": [ { "b": 1 }, { "b": null } ] } => true
|
||||
// { "a": [ { "b": 1 }, { "b": 2 } ] } => false
|
||||
MultiValue::Multiple(vals) => vals.iter().any(|val| val.is_null()),
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,11 +150,12 @@ def is_empty_condition():
|
||||
assert response.ok
|
||||
|
||||
json = response.json()
|
||||
assert len(json['result']) == 3
|
||||
assert len(json['result']) == 4
|
||||
|
||||
ids = [x['id'] for x in json['result']]
|
||||
assert 5 in ids
|
||||
assert 6 in ids
|
||||
assert 7 in ids
|
||||
assert 8 in ids
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user