"error": variables are not allowed in facets filter

Hi all,

I’m not able to filter the @facets using a variable, please help me with this. Thanks!

Share details of what you did.

Cheers

Hi Michel,

Thank you for your response, here is my query.

{
var(func: eq(userlist.publicId, "1010")){
userlist.userInterests @facets (priority){
id as skills.skillPublicId
}
}

{
my(func: eq(userlist.publicId, "1010")){
username: userlist.username
publicId: userlist.publicId
collaboration: userlist.collaboration @facets(skillPublicId: skillPublicId) @facets(eq(skillPublicId, val(id))){
username: userlist.username
publicId: userlist.publicId
}
}
}
}

I’m trying to find the userInterests for a given user and these userInterests in a variable named id are used to filter the facets. But I’m getting this error (please find the attached screenshots) This works if I hardcode a value.

Please help me, thanks!

This is the output I get when I hardcode a value.

I see, here is a ticket for this Allow value variables in facet filters

Sorry, but It isn’t really supported to use val on facets. Add a comment in that ticket.

Cheers.

1 Like