在Solr查询中使用inner Join
在SQL中,我有这样的查询
SELECT * FROM table1 INNER JOIN table2 ON table1.table1To2Id = table2.table2Id INNER JOIN table3 ON table1.table1To3Id = table3.table3Id
我如何使用Solr进行相同的查询? 鉴于SQL中的字段与Solr中的字段相同
预先感谢
我相信你正在寻找这样的东西:
SQL:
SELECT *
FROM books
WHERE id IN (SELECT bookId
FROM bookauthors
WHERE authorId IN (SELECT authorId
FROM author
WHERE author.name LIKE '%Rowling%'))
Solr的:
http://<code>hostname:8983/solr/select?q=*:*&fq={!join+from=bookId+to=id}authorId:{!join+from=authorId+to=authorId}author.name:Rowling
关键是在传递下一个连接查询之后:
而不是传递值。 有关更多信息,请参阅此
上一篇: Using inner Join in Solr query
下一篇: LEFT JOIN or INNER JOIN to find items from one table that are in second table