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

Hello!

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?

2 Likes

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.

1 Like

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?

1 Like

thank you guys :smiley:

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