Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-datastore
Commits
d099e8e2
Unverified
Commit
d099e8e2
authored
Feb 14, 2020
by
Steven Allen
Committed by
GitHub
Feb 14, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #147 from ipfs/fix/optimize-naive-query
fix: avoid filtering by prefix unless necessary
parents
ac8b6e68
ec27f419
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
query/query_impl.go
query/query_impl.go
+2
-4
No files found.
query/query_impl.go
View file @
d099e8e2
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment