Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion finder/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ func (idx *IndexFinder) validatePlainQuery(query string, wildcardMinDistance int

var maxDist = where.MaxWildcardDistance(query)

if maxDist != -1 && maxDist < wildcardMinDistance {
// If the amount of nodes in a plain query is equal to 1,
// then make an exception
// This allows to check which root nodes exist
moreThanOneNode := strings.Count(query, ".") >= 1

if maxDist != -1 && maxDist < wildcardMinDistance && moreThanOneNode {
return errs.NewErrorWithCode("query has wildcards way too early at the start and at the end of it", http.StatusBadRequest)
}

Expand Down
10 changes: 9 additions & 1 deletion tests/wildcard_min_distance/test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,12 @@ timeout = "1h"
targets = [
"*.*",
]
error_regexp = "^400: query has wildcards way too early at the start and at the end of it"
error_regexp = "^400: query has wildcards way too early at the start and at the end of it"

[[test.render_checks]]
from = "rnow-10"
until = "rnow+1"
timeout = "1h"
targets = [
"*",
]
Loading