Error: Regular expression is too wide-ranging and can't be executed efficiently

(Michael Beeson) #1


So imagine a user is searching through a sequence of nodes with a value for “name”. As they enter values into the searchbar, the list of returned results is whittled down (a very common scenario).

In MySQL I would use something like "WHERE name LIKE('%$search%')". This would work whether $search was “Michael”, “Mic” or completely empty.

I figured that with dGraph this could be achieved with a trigram schema, and I use the following:

AND regexp(name, /.*${search[key]}.*/i)

But if the search value is too small, like “be”, I get this error:

Regular expression is too wide-ranging and can't be executed efficiently.

Is there a way to achieve something similar to the var LIKE('%something%') in dgraph?

(Gus) #2

Not at the moment. The best you can do is remove the leading % so that it’s not a range regex. This is an enhancement that we have been thinking about but we need to consider performance and compatibility.

(James) #3

please prioritize on this, its an essential features that might make people reconsider using dgraph… i think partial lookup is quite a norm.

maybe can be based on fulltext index?

(James) #4

thank you guys :smiley:

(system) closed #5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.