简体   繁体   中英

Facet for Empty or null values for any field in Solr

I am using Facet in my solr implemententation. 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

Sample Data for Solr fields

US (6) CA (5) IND (5)

I also want to show facet as [Empty] (7)

Please suggest some workaround to get Facet for empty values.

You can use facet.missing to get a count for the number of documents that doesn't have a value in the field .

The facet.missing Parameter

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.

The default value is false .

This parameter can be specified on a per-field basis with the syntax of f.<fieldname>.facet.missing .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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