[#1656] meta: Fix MatchCommonPrefix
operation
Return all the objects on the empty common prefix search without search optimizations that breaks boltDB logic. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
156ba85326
commit
a5da665e69
1 changed files with 6 additions and 0 deletions
|
@ -222,6 +222,12 @@ func stringCommonPrefixMatcherBucket(b *bbolt.Bucket, fKey string, fVal string,
|
|||
prefix = val[:len(val)-1]
|
||||
}
|
||||
|
||||
if len(val) == 0 {
|
||||
// empty common prefix, all the objects
|
||||
// satisfy that filter
|
||||
return b.ForEach(f)
|
||||
}
|
||||
|
||||
c := b.Cursor()
|
||||
for k, v := c.Seek(val); bytes.HasPrefix(k, prefix); k, v = c.Next() {
|
||||
if checkLast && (len(k) == len(prefix) || k[len(prefix)]>>4 != val[len(val)-1]) {
|
||||
|
|
Loading…
Reference in a new issue