[英]Query multiple collections Arangodb
FOR col_name IN ['col_1', 'col_2']
FOR d IN FULLTEXT(col_name, 'label', @value)
RETURN d
does not works 不起作用
but 但
FOR d IN FULLTEXT('col_1', 'label', @value)
RETURN d
works fine 工作正常
I am using arango 3.4.2-1 我正在使用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 如AQL手册中有关连接的文档所述
Please note that simple string equalities can be done using FILTER
s and don't need fulltext indices. 请注意,可以使用
FILTER
来完成简单的字符串相等操作,并且不需要全文索引。
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. 实现此目的的更现代方法是使用可以处理大量集合的ArangoSearch视图 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.