William Wu
William Wu

Reputation: 483

algolia filters and pagination error

can I actually use filters and pagination at the same query? I can use filters and returns what I expected:

const query = { filters: `type: ${type}`};

but it returns error when I add page in query:

const query = { filters: `type: ${type}`, page: 2 };

err msg reads:

AlgoliaSearchError {name: "AlgoliaSearchError", message: "filters: Unexpected token string(Object]) expected end of filter at col 14", debugData: Array(1), statusCode: 400, __zone_symbol__currentTask: ZoneTask…}

Upvotes: 1

Views: 789

Answers (1)

vvo
vvo

Reputation: 2881

this should definitely works but it also depends on what does ${type} gets replaced with.

Can you try with:

const query = { filters: `type:"${type}"`, page: 2 };

Notice the removal of spaces and addition of double quotes. Could you log exactly your query object at the time of the error? That would help, thanks!

Upvotes: 5

Related Questions