New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[How to use regexp in @filter]: <regexp use> #8996
Comments
We don't have a query planner yet, Dgraph may not do a good job in figuring out in what order to execute the filters. Is it possible for you to share the data? It may still be worth looking into this. |
`package main import ( func nodeExists(dg *dgo.Dgraph, id string) (bool, error) { func saveNode(dg *dgo.Dgraph, j int) error {
} func saveRelation(dg *dgo.Dgraph, srcID, dstID string) error {
} func main() {
} |
Definitely a problem. Regexp in filter should use the index. See also this discuss thread for same issue: https://discuss.dgraph.io/t/how-to-use-regexp-in-filter/18901/8 . My guess is that when regexp was allowed in the filter, someone mistakenly or naively thought it would not need to be indexed. So it's a feature that you can post-filter with regexp, but misleading that it does not use the filter. I suspect GraphQL will build this underlying (non-optimized) DQL structure under the hood, making this more impactful for those users. |
Question.
I had about 50million nodes,if I use ‘regexp’ like “{
resources(func:regexp(name, /abc/i) )@filter(eq(workspace_key, "def")) {
id
name
resource_key
}
}”,
it will be fast with in 1 second,however,
if I use it like "{
resources(func: eq(workspace_key, "def"))@filter(regexp(name, /abc/i)) {
id
name
resource_key
}
}",
it will be useless and overtime. Most of the time I have to spell out a complex logical combination, so it's impossible to put a regexp in "func" but filter.
So I really wanna know whether the index is invalid when I use 'regexp' in @filter?
And if somebody has a good idea to solve this problem?
The text was updated successfully, but these errors were encountered: