Is it possible to use variables with regex search when using the Dgraph go client?
We could built the query with SprintF but that would be insecure.
q :=query Search($searchterm: string) {
subdomains(func: regexp(name, /^.*$searchterm/)) {
uid:uid
name:name
}
}
The following query does not return any results, even tho they exist.
q := `query Search($searchterm: string) {
subdomains(func: regexp(name, /$searchterm/)) {
uid:uid
name:name
}
}`
Or this
q := `query Search($searchterm: string) {
subdomains(func: regexp(name, /.*$searchterm.*/)) {
uid:uid
name:name
}
}`
Then send the query to dgraph using: txn.QueryWithVars(ctx, q, variableMap)
Edit: This is a bug.