Report a GraphQL Bug
What edition and version of Dgraph are you using?
Edition:
- SlashGraphQL
- Dgraph (community edition/Dgraph Cloud)
If you are using the community edition or enterprise edition of Dgraph, please list the version:
Dgraph Version
$ dgraph version
dgraph/standalone:v21.03.0
Have you tried reproducing the issue with the latest release?
Steps to reproduce the issue (paste the query/schema if possible)
Schema
type Place { name: String! @search(by: [regexp]) }
Expected behaviour and actual result.
GraphQL query with regexp filter is scanning all the rows
{ queryPlace(filter: {name: {regexp: "/bucure.ti/i"}}) { name } }
result for graphql
{ "data": { "queryPlace": [ { "name": "Bucureştii Noi" }, { "name": "București" }, { "name": "Bucuresti" }, { "name": "Cotul Bucureşti" }, { "name": "Municipiul Bucureşti" } ] }, "extensions": { "touched_uids": 261349, "tracing": { "version": 1, "startTime": "2021-06-16T22:35:01.987425572Z", "endTime": "2021-06-16T22:35:06.523753638Z", "duration": 4536327298, "execution": { "resolvers": [ { "path": [ "queryPlace" ], "parentType": "Query", "fieldName": "queryPlace", "returnType": "[Place]", "startOffset": 245354, "duration": 4536045138, "dgraph": [ { "label": "query", "startOffset": 355774, "duration": 4535928083 } ] } ] } } } }
DQL query is working as expected
{ place_regexp_search(func: regexp(Place.name, /bucure.ti/i)) { Place.name } }
result
{ "data": { "place_regexp_search": [ { "Place.name": "Bucureştii Noi" }, { "Place.name": "București" }, { "Place.name": "Bucuresti" }, { "Place.name": "Cotul Bucureşti" }, { "Place.name": "Municipiul Bucureşti" } ] }, "extensions": { "server_latency": { "parsing_ns": 76685, "processing_ns": 1431587, "encoding_ns": 45256, "assign_timestamp_ns": 643229, "total_ns": 2303263 }, "txn": { "start_ts": 50078 }, "metrics": { "num_uids": { "Place.name": 5, "_total": 5 } } } }