Skip to content

Commit

Permalink
Merge pull request #147 from ipfs/fix/optimize-naive-query
Browse files Browse the repository at this point in the history
fix: avoid filtering by prefix unless necessary
  • Loading branch information
Stebalien committed Feb 14, 2020
2 parents ac8b6e6 + ec27f41 commit d099e8e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions query/query_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d099e8e

Please sign in to comment.