简体   繁体   English

Solr 中任何字段的空或 null 值的构面

[英]Facet for Empty or null values for any field in Solr

I am using Facet in my solr implemententation.我在我的 solr 实现中使用 Facet。 Facets are display for all the keywords of fields having concrete values.为具有具体值的字段的所有关键字显示构面。

Facets are not displayed for the empty values.空值不显示分面。 I want to show a facets for empty values as well.我也想显示空值的方面。

For example, in below example data facet is displayed for the value in Country field as例如,在下面的示例中,Country 字段中的值的数据方面显示为

Sample Data for Solr fields Solr 字段的示例数据

US (6) CA (5) IND (5)美国 (6) 加利福尼亚 (5) 印第安纳州 (5)

I also want to show facet as [Empty] (7)我还想将 facet 显示为 [Empty] (7)

Please suggest some workaround to get Facet for empty values.请建议一些解决方法来获取 Facet 的空值。

You can use facet.missing to get a count for the number of documents that doesn't have a value in the field .您可以使用facet.missing来计算在 field 中没有值的文档的数量

The facet.missing Parameter facet.missing参数

If set to true, this parameter indicates that, in addition to the Term-based constraints of a facet field, a count of all results that match the query but which have no facet value for the field should be computed and returned in the response.如果设置为 true,则此参数表示,除了 facet 字段的基于 Term 的约束之外,还应计算与查询匹配但没有该字段的 facet 值的所有结果的计数并在响应中返回。

The default value is false .默认值为false

This parameter can be specified on a per-field basis with the syntax of f.<fieldname>.facet.missing .可以使用f.<fieldname>.facet.missing的语法在每个字段的基础上指定此参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM