可以对以下solr集合执行查询
{
"id":1,
"book_name":"Solr book",
"category":[1,2,3],
"author":[1]
},
{
"id":1,
"book_name":"Rocky",
"category":[3],
"author":[2]
},
{
"category_id": 1,
"category_name":"Technology"
},
{
"category_id": 2,
"category_name":"Apache Lucene"
},
{
"category_id": 3,
"category_name":"Sport"
},
{
"author_id": "1",
"author_name" "Chuck Norris"
},
{
"author_id": "1",
"author_name" "John Rambo"
}
将返回类似的内容:
{
"id": 1,
"book_name": "Solr book",
"categories": ["Technology", "Apache Lucene"],
"Authors": ["Chuck Norris"]
}
在典型的Searchbox输入中按book_name和/或category_name AND / OR作者名称进行搜索?或另一种回应,我将返回类似的东西?
否则这是实现它的首选解决方法/最佳实践?
...我们希望通过前端Web应用执行单个查询,不使用使用Backend Web App来构建响应,因为该数据已经在solr中。
答案 0 :(得分:0)
我确定收藏的方式是错误的,我是这样做的:
<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/circulo_lectores"
user=""
password="" />
<document>
<entity name="book" query="SELECT * FROM book">
<field column="id" name="id"/>
<field column="book" name="book" />
<entity name="book_author" query="SELECT * FROM book_author WHERE book_id= ${book.id}">
<field column="author_id" name="author_id" />
<entity name="author" query="select * FROM author WHERE id = ${book_author.author_id}">
<field column="author_name" name="author_name" />
</entity>
</entity>
<entity name="book_category" query="SELECT * FROM book_category WHERE book_id= ${book.id}">
<field column="category_id" name="category_id" />
<entity name="category" query="select * FROM category WHERE id = ${book_category.category_id}">
<field column="category_name" name="category_name" />
</entity>
</entity>
</entity>
</document>
</dataConfig>
这reference给了我线索。希望它有助于其他人