Unexpected token string(...) in search filter

I’m programatically setting facet filters in an Android application as so:

index.searchAsync(new Query(searchText).setFilters(“category:”+categoryName), completionHandler);

But whenever I try to set a filter that contains more than one word (e.g. categoryName = “two words”) I get this error:

algolia Error received: com.algolia.search.saas.AlgoliaException: filters: Unexpected token string(words) expected end of filter at col 17

Does anyone know how to set filters containing more than just one word?

Note: It works fine in the online console.

Just found this in the docs:

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

I tested it out and it works.

Great! Glad you found a resolution. Go go docs! :slight_smile:

2 Likes