SolrNet:过滤查询时保持Facet计数

时间:2016-11-23 08:11:22

标签: solr solrnet

当我查询

时,我收到以下方面
"Field1": [
  {
    "Key": "Best Facet 1",
    "Value": 999
  },
  {
    "Key": "Best Facet 2",
    "Value": 999
  }
],
"Field2": [
  {
    "Key": "Second Best Facet 1",
    "Value": 421
  },
  {
    "Key": "Second Best Facet 2",
    "Value": 103
  }
]

现在我想在Field2 =" Second Best Facet 2"

上应用过滤查询(fq)

我收到的结果是

"Field1": [
  {
    "Key": "Best Facet 1",
    "Value": 103
  },
  {
    "Key": "Best Facet 2",
    "Value": 103
  }
],
"Field2": [
  {
    "Key": "Second Best Facet 1",
    "Value": 103
  },
  {
    "Key": "Second Best Facet 2",
    "Value": 103
  }
]

我需要将facet计数保持一致并且不受所应用的过滤器的影响。我无法找到解决问题的方法。

1 个答案:

答案 0 :(得分:1)

计算分面得分时可以tag your filters and tell Solr to ignore those filters

fq={!tag=dt}doctype:pdf&facet.field={!ex=dt}doctype

fq=会应用过滤条件,但会使用标记dt对过滤条件进行标记,并告知facet.field排除标记为dt的所有过滤条件,它仍会计算出计数在整个集合中,而不仅仅是过滤后的值。

  

所有类型的构面都支持过滤器排除。标记和ex本地参数都可以通过用逗号分隔来指定多个值。