-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
If you suspect this could be a bug, follow the template.
-
What version of Dgraph are you using?
v1.0.10 -
Have you tried reproducing the issue with latest release?
yes -
What is the hardware spec (RAM, OS)?
Google Kubernetes Engine using the official dgraph images -
Steps to reproduce the issue (command/config used to run Dgraph).
We are using dgraph-js-http library for communicating with dgraph server from a browser. We do the following query:
const request = `query documents($query: string) {
documents(func: alloftext(text, $query)) {
text
}
}`
const {
data: { documents },
} = await client.newTxn().queryWithVars(request, {
$query: search // input from user
})
We found a problem with how variables are handled. The variables work fine for queries that only use US-ASCII letters like "foo bar" but won't match queries that contain letters like "öä".
We tracked this down to HTTP RFC7230 defining header values to be made of USASCII characters which don't include åäö for example. This causes browsers to encode such values as \xf6 and similar encoding.
If the query was in format:
{
documents(func: alloftext(text, "öä")) {
text
}
}
and not using variables then the query would return results as expected.
You should be able to test this easily by having some text that contains non usascii letters and matching that with query that contains variables. I'm not sure whether this need to be fixed in dgraph, dgraph-http-json or both.
- Expected behaviour and actual result.
We expect dgraph to match non usascii letters as well when doing queries with variables.
I can provide example code in GitHub repository if that helps.