javascript - 在内容中搜索多个参考字段
问题描述
我试图弄清楚如何根据作者(参考)检索特定文章,我当前的函数检索所有文章,但我只想要作者特定的文章
const resp = yield client.getEntries({
'fields.insightsArticle': true,
'fields.excludeCountries[nin]': country,
'fields.publicationDate[lte]': moment(new Date()).toISOString(),
'fields.author.fields.firstname': author.firstName,
'fields.author.fields.lastname': author.lastName,
content_type: 'insight',
include: 2,
order: '-fields.publicationDate',
limit,
locale,
});
我从内容获得的当前日志是:“在搜索参考资料时,您必须指定参考资料的内容类型。请发送内容类型 ID 作为查询参数”
我明白了,因为我将内容类型定义为洞察力。
欢迎任何建议!
解决方案
我有同样的问题!您可以通过添加来指定引用的内容类型:
'fields.author.sys.contentType.sys.id': 'author'
另外,我会将 content_type: 'insight' 行作为第一个条目并删除限制和语言环境,因为您没有使用这些字段。
推荐阅读
- javascript - 如何只制作 html 'tabbable' 的一部分?(模态对话框)
- javascript - 如何使用扩展运算符从对象数组中删除重复项
- protractor - 是否可以创建一个包含我所有功能的文件并在我的规范中从中读取?
- python - python中的伽玛函数没有绘制我所期望的
- sql - 如何将第一列中的每个字符串与 TSQL 中第二列中的每个字符串进行比较?
- firefox - 如何禁用 Firefox URL 更正
- python - 如何使这种逐行操作高效(python)?
- java - Vaadin 8 的数字输入
- c++ - clang-format:将尾随说明符保留在单行上
- curl - apiary.io—404—未找到资源,有人知道我的错误是什么吗?