我有以下查询:
/search?facet.pivot=host&facet.pivot=name&facet=on&indent=on&q=&rows=10&start=0&wt=json
这是响应标题
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":420,
"params":{
"q":"",
"facet.pivot":["host",
"name"],
"indent":"on",
"start":"0",
"rows":"10",
"facet":"on",
"wt":"json",
"_":"1512394263979"}}
主机部分始终是域stackoverflow.com
或google.com
,而名称的全名类似于Stack Exchange Inc
或Google Inc.
,因此使用此查询的结果就像这样:
"response":{"numFound":2,"start":0,"maxScore":56.923157,"docs":[
{
"host":"google.com",
"name":"Google Inc."},
{
"url":"stackoverflow.com",
"name":"Stack Exchange Inc."},
]
},
"facet_counts":{
"facet_queries":{},
"facet_fields":{},
"facet_ranges":{},
"facet_intervals":{},
"facet_heatmaps":{},
"facet_pivot":{
"host":[{
"field":"host",
"value":"google.com",
"count":1},
{
"field":"host",
"value":"stackoverflow.com",
"count":1}]
},
"facet_pivot":{
"name":[{
"field":"name",
"value":"Inc.",
"count":2
{
"field":"name",
"value":"Google",
"count":1},
{
"field":"name",
"value":"Stack",
"count":1},
{
"field":"name",
"value":"Exchange",
"count":1}]
},
....
问题是我如何匹配整个名字?所以枢轴将是
"facet_pivot":{
"name":[{
"field":"name",
"value":"Google Inc.",
"count":1},
{
"field":"name",
"value":"Stack Exchange Inc.",
"count":1}]
},
答案 0 :(得分:0)
发现了这个问题。 name
字段类型为text
,它被标记化,因此它将被空格切换为多个单词。解决方案是将名称字段复制到另一个类型为'string'的字段,然后facet.pivot=name_str
将解决问题
在这个答案中有更多解释:https://stackoverflow.com/a/17915897/2724879