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

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-10-01 16:34:15 +03:00 committed by Alex Vanin
parent 51e373c3f0
commit 6824a6f67b

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)
}
}
}