I can’t find the accurate way to use this index on arrays. Not to say that this regular expressions seems to be so specific that they end losing the flexibility of using them (they end looking more like a oneofterms or a anyofterms so they lose their purpose/functionality). For example:
I have this schema:
mutation {
schema {
group: string @index(exact,term) .
name: string @index(exact,term) .
array_str: [string] @index(trigram) .
}
}
Then I add this data (I don’t know if there is a shortcut to massively add all the “array_str” elements, please tell me if there is one):
mutation {
set {
_:root <group> "test" .
_:root <name> "root" .
_:root <array_str> "first" .
_:root <array_str> "second" .
_:root <array_str> "third" .
_:root <array_str> "fourth" .
}
}
But making queries like the following won’t work at all:
{
root(func:regexp(array_str, /.*rd$/))@filter(eq(group,"test") and regexp(array_str,/.*rd$/)){
expand(_all_)
}
}
RETURNS: Regular expression is too wide-ranging and can’t be executed efficiently.
{
root(func:regexp(array_str, /[a-z]+rd$/))@filter(eq(group,"test") and regexp(array_str,/[a-z]+rd$/)){
expand(_all_)
}
}
RETURNS: Regular expression is too wide-ranging and can’t be executed efficiently.
{
root(func:regexp(array_str, /third/))@filter(eq(group,"test") and regexp(array_str,/third/)){
expand(_all_)
}
}
RETURNS: NOTHING - Showing 0 nodes and 0 edges (I will expect the just inserted node as it contains “third”)
Any suggestions to make this work? Seems like right now this index doesn’t provides hard regex functionality and is just another way of implementing “anyofterms” and “oneofterms”.
Thank you!