请参阅以下文档:https://wiki.apache.org/solr/Join
根据文档,SOLR等效于此SQL查询:
SELECT xxx, yyy
FROM collection1
WHERE outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
就是这样:
/solr/collection1/select ? fl=xxx,yyy & q={!join from=inner_id to=outer_id}zzz:vvv
基本上,我想做的SQL等同于:
SELECT xxx, yyy
FROM collection1
WHERE (aaa = "1" OR bbb = "2")
OR outer_id IN (SELECT inner_id FROM collection1 where zzz = "vvv")
是否可以在SOLR中执行此查询?
答案 0 :(得分:1)
您的查询应该是
fl=xxx,yyy&q=(aaa:1 bbb:2) {!join from=inner_id to=outer_id}zzz:vvv
应解释为(aaa:1 OR bbb:2) OR {!join from=inner_id to=outer_id}zzz:vvv