I’ve noticed that certain filters doesn’t work as expected when running GraphQL query against dgraph, but works fine when running GraphQL± query from Ratel.
Given following GraphQL schema applied to local dgraph instance and after uploading data.
interface Node{
id: ID!
}
type Company implements Node {
companyId: String! @search(by: [hash])
entityId: String! @search(by: [hash])
name: String! @search(by: [hash, fulltext, trigram])
}
This GraphQL query
{
getCompany(id: "0x2") {
id
name
companyId
entityId
}
byEntityId: queryCompany(filter: { entityId: { eq: "061TZG-E" } }) {
id
name
companyId
entityId
}
byCompanyId: queryCompany(filter: { companyId: { eq: "241285" } }) {
id
name
companyId
entityId
}
}
Doesn’t return data when filtering by companyId
{
"data": {
"getCompany": {
"id": "0x2",
"name": "University of Miami",
"companyId": "241285",
"entityId": "061TZG-E"
},
"byEntityId": [
{
"id": "0x2",
"name": "University of Miami",
"companyId": "241285",
"entityId": "061TZG-E"
}
],
"byCompanyId": []
}
}
Similar query in Ratel
{
getCompany(func: uid(0x2)) {
uid
Company.name
Company.companyId
Company.entityId
}
byEntityId(func: eq(Company.entityId, "061TZG-E")) {
uid
Company.name
Company.companyId
Company.entityId
}
byCompanyId(func: eq(Company.companyId, "241285")) {
uid
Company.name
Company.companyId
Company.entityId
}
}
Returns all data as expected
{
"data": {
"getCompany": [
{
"uid": "0x2",
"Company.name": "University of Miami",
"Company.companyId": "241285",
"Company.entityId": "061TZG-E"
}
],
"byEntityId": [
{
"uid": "0x2",
"Company.name": "University of Miami",
"Company.companyId": "241285",
"Company.entityId": "061TZG-E"
}
],
"byCompanyId": [
{
"uid": "0x2",
"Company.name": "University of Miami",
"Company.companyId": "241285",
"Company.entityId": "061TZG-E"
}
]
},
"extensions": {
"server_latency": {
"parsing_ns": 102305,
"processing_ns": 14200971,
"encoding_ns": 23572,
"assign_timestamp_ns": 551218,
"total_ns": 14944192
},
"txn": {
"start_ts": 1819
},
"metrics": {
"num_uids": {
"": 1,
"Company.companyId": 3,
"Company.entityId": 3,
"Company.name": 3,
"uid": 3
}
}
}
}
What might be causing this inconsitency?