Getting ""filters: Unexpected token ':' expected ')' at col 14"

Getting "“filters: Unexpected token ‘:’ expected ‘)’ at col 14”
when I try to add _tags in my filters. Not sure what’s wrong.
Note:
I have tags called “CHILDOF:Account”
I also have a facet called “CHILDOF”.

It works from the dashboard but when I try to use it in the nodejs client, I get that error. Any help appreciated.

Here is my query:

{
attributesToRetrieve:"*"
filters:"(_tags:CHILDOF:Account) AND (orgId:testOrg OR orgId:ALL)"
hitsPerPage:1
page:"0"
query:"and"
}

Hi, since “:” is a keyword of the filters parameter, you will have to wrap your CHILDOF:Account into double quotes. Like so:

{
attributesToRetrieve:"*"
filters:'_tags:"CHILDOF:Account" AND (orgId:testOrg OR orgId:ALL)'
hitsPerPage:1
page:"0"
query:"and"
}

This is explained in our docs, (a bit hidden yes because it’s an edge case): https://www.algolia.com/doc/api-reference/api-parameters/filters/

If a value contains spaces, or conflicts with a keyword, you can use double quotes.

1 Like

Thanks for the quick response!