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

SolrNet : Keep Facet count when filtering query

我在查询 时收到以下方面:

"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
  }
]

我需要构面计数保持一致并且不受所应用过滤器的影响。我找不到问题的任何解决方案。

您可以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 的过滤器,它仍然会计算整个集合的计数,而不仅仅是过滤后的值。

Filter exclusion is supported for all types of facets. Both the tag and ex local params may specify multiple values by separating them with commas.