[#61] object/search: Support non-root and non-leaf filters

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
support/v0.27
Leonard Lyubich 2020-10-01 16:34:15 +03:00 committed by Alex Vanin
parent 51e373c3f0
commit 6824a6f67b
1 changed files with 2 additions and 2 deletions

View File

@ -45,9 +45,9 @@ func (q *Query) Match(obj *object.Object, handler func(*objectSDK.ID)) {
default:
match = headerEqual(obj, key, q.filters[i].Value())
case objectSDK.KeyRoot:
match = !obj.HasParent()
match = (q.filters[i].Value() == objectSDK.ValRoot) == !obj.HasParent()
case objectSDK.KeyLeaf:
match = par == nil
match = (q.filters[i].Value() == objectSDK.ValLeaf) == (par == nil)
}
}
}