You cannot use @groupby for “string attribute”.
Assuming you are using gby the correct way, you would need to provide a sample mutation. To understand your line of reasoning.
The only way to search for something is via search functions and correct indexing as desired.
This query does not make much sense.
I’m assuming you have in the predicate “label” the word “cat”. So will never be able to do “@filter(gt”.
The correct would be this, but I know it is not the desired one:
{
var(func: has(label)) @filter(eq(label, "cat")) @groupby(label) {
# PS. For now that's wrong in Dgraph. You can't groupby label value, just UIDs linking
c as count(uid)
}
me(func: uid(c)) {
label
ct: val(c)
}
}
Well, for the simple fact that you are grouping by a Label. You will already have the nodes supposedly duplicates in the very same group. Then you do not need anything else. If the group has more than one, you have found the duplicates.
Now if you want to search by group and then in another predicate find a duplicate. Add a new filter in the query block would suffice. But in this case you would be looking for duplicates (according to your criteria) in the same group.
There is no way the Dgraph returns to you something like duplicate. As an answer like “True” for “we have a duplicate”. Dgraph assumes that you are entering the data correctly. You have to use filters and check this via application for this.
Cheers.