我正在使用SOLR 4.9版本。以下是我的索引文档。
{
"id": "1",
"index_id": "index",
"tm_title":"Avenger"
"category":"1"
"type":"movie"
"article_type":"Hollywood"
},
{
"id": "2",
"index_id": "index",
"tm_title":"Avenger 2: Age of ultron"
"category":"1",
"type":"movie"
"article_type":"Hollywood"
},
{
"id": "3",
"index_id": "index",
"tm_title":"Spiderman"
"category":"2"
"type":"movie"
"article_type":"Hollywood"
},
{
"id": "4",
"index_id": "index",
"tm_title":"Emy Jackson"
"type":"celebrity"
"article_type":"Hollywood"
},
{
"id": "5",
"index_id": "index",
"tm_title":"Jim Watson"
"type":"celebrity"
"article_type":"Hollywood"
}
现在要求就像这样的电影和名人结果的组合。
我搜索了很多,但没有找到解决方案。 我正在尝试以下查询。
FOR Query 1:
localhost:8983/solr/collection1/select?q=Hollywood&fq=if(exist(category),category:2,'');
FOR Query 2:
localhost:8983/solr/collection1/select?q=Hollywood&fq=if(exist(category),category:1,'');
答案 0 :(得分:0)
使用AND运算符
localhost:8983/solr/collection1/select?q=article_type:Hollywood AND category:2 AND type:celebrity
第二次查询
localhost:8983/solr/collection1/select?q=article_type:Hollywood AND category:1 AND type:celebrity