Is it not possible to use has() to check if a facet exists?

Currently trying a query like below:

        {
            query(func: uid(0xfffd8d67d83cf7fc)) {
                next @facets(has(facet1)) {
                    uid
                    name
                }
            }
        }

And I get the error message: One argument expected in has, but got 0.

3 Likes

Also, the error messages generally seem very confusing.

This syntax below is equivalent to “has” func.

next @facets(facet1)

if it doesn’t exist, it will be empty.

But it doesn’t do a filter. @MichelDiz

I am looking for a equivalent for

next @facets(eq(facet1, 1))

but instead of checking value, just check presence of the facet.

I see, there is this issue Improve Facets functions. (not supported in preprocessFilter) · Issue #2896 · dgraph-io/dgraph · GitHub related to this.

Facets needs improvements. But as there’s none interest from the community, it gets low priority.

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