Unverified Commit d099e8e2 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #147 from ipfs/fix/optimize-naive-query

fix: avoid filtering by prefix unless necessary
parents ac8b6e68 ec27f419
......@@ -129,12 +129,10 @@ func NaiveQueryApply(q Query, qr Results) Results {
}
prefix = path.Clean(prefix)
}
// If the prefix isn't "/", end it in a "/" so we only find keys
// _under_ the prefix.
// If the prefix is empty, ignore it.
if prefix != "/" {
prefix += "/"
qr = NaiveFilter(qr, FilterKeyPrefix{prefix + "/"})
}
qr = NaiveFilter(qr, FilterKeyPrefix{prefix})
}
for _, f := range q.Filters {
qr = NaiveFilter(qr, f)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment