arangodb - 查询多个集合 Arangodb
问题描述
FOR col_name IN ['col_1', 'col_2']
FOR d IN FULLTEXT(col_name, 'label', @value)
RETURN d
不工作
但
FOR d IN FULLTEXT('col_1', 'label', @value)
RETURN d
工作正常
我正在使用 arango 3.4.2-1
解决方案
in general you can query two collections like this:
FOR col1doc IN col_1
FILTER col1doc.foo == 'bar'
FOR col2doc IN col_2
FILTER col1doc.joinfield == col2doc.joinfield
RETURN {col1doc: col1doc, col2doc: col2doc}
as its documented in the AQL manual for joins
Please note that simple string equalities can be done using FILTER
s and don't need fulltext indices.
To the old fulltext index for two collections you can use subqueries like this:
let col1Documents = (FULLTEXT(col_1, 'label', @value))
let col2Documents = (FULLTEXT(col_2, 'label', @value))
RETURN CONCAT(col1Documents, col2Documents)
The more modern way to achieve this would be to use ArangoSearch views which can handle numerous collections.
推荐阅读
- azure - SignalR with Azure - 在发布配置与调试配置(.net core 3.1)上默认由 Azure.SignalR 服务强制执行
- c++ - 即使使用完整路径,ifstream 也无法在 XCode 中打开文件[已解决]
- docker - docker-compose 如何添加多个命令?
- firebase - Firebase Analytics:如何为 Firebase Analytics 获取和集成 UA 类型测量 ID 而不是 G 类型测量 ID?
- amazon-web-services - 新修改的文件,在 CMD 中创建并列出大文件
- javascript - 样式化的组件嵌套规则不起作用
- c++ - 基类虚拟析构函数——五法则?
- regex - Vim 正则表达式查找匹配后行上的替换选项卡
- javascript - 如何在openlayer中使用幻想世界的高质量jpg改变世界观?
- c - 使用 perl 更新 C 文件中的宏