【问题标题】:Joining three tables in solr在 solr 中连接三个表
【发布时间】:2016-12-07 06:49:34
【问题描述】:
我正在尝试使用 Solr 加入三个 cassandra 表。根据datastax文档,
DataStax Enterprise 4.0.2 及更高版本支持 OS Solr 查询时间
通过自定义实现加入。您可以加入 Solr 文档,
包括在这些条件下具有不同 Solr 内核的那些:
- Solr 内核需要具有相同的键空间和相同的 Cassandra 分区键。
- 支持连接 Solr 核心的 Cassandra 表必须与 Thrift 或 CQL 兼容。你不能拥有一个
一个是 Thift 兼容的,一个是 CQL 兼容的。
- 唯一键的类型(分区键的 Cassandra 键验证器)相同。
- 表分区键和模式唯一键的顺序相同。
我可以按照文档加入两个表。我想知道是否可以将满足条件的三个表连接在一起。找不到任何有关加入两个以上表的文档。我迫切需要加入三张桌子。真的有可能还是我现在应该放弃这个想法?
【问题讨论】:
标签:
join
solr
cassandra
datastax
【解决方案1】:
我需要的是递归连接。从与上述示例相同的文档中,我可以找到以下示例:
Use a nested join query to recursively join the songs and lyrics documents with the videos document, and to select the song that mentions love and also won a video award.
http://localhost:8983/solr/internet.songs/select/?q=
{!join+fromIndex=internet.lyrics}words:love AND _query_:
{!join+fromIndex=internet.videos}award:true&indent=true&wt=json
Output is:
"response":{"numFound":1,"start":0,"docs":[
{
"song":"a3e64f8f-bd44-4f28-b8d9-6938726e34d4",
"title":"Dangerous",
"artist":"Big Data"}]
}}