2017-07-31 67 views
1

我真的可以在同一个查询中使用过滤器和分页吗? 我可以使用过滤器,并返回我的预期:algolia过滤器和分页错误

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

,但是当我在查询添加页面返回错误:

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

错误消息写着:

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…} 

回答

2

这绝对应该但它也取决于$ {type}被替换的内容。

你能尝试使用:

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

通知拆除的空间和另外双引号的。 您可以在发生错误时准确记录您的查询对象吗?这将有所帮助,谢谢!

+0

通过添加双引号和删除空格,它工作正常。谢谢。 –