在一个 SOLR 查询中获取多个字段的不同值

Fetch distinct values of multiple fields in one SOLR query

有没有办法在单个 SOLR 查询中查询多个字段的不同值?

我知道分面字段,但它一次只适用于一个字段。

方面:真,facet.field:XYZ

您可以在查询中提供多个 facet.field 键:

facet.field=field1&facet.field=field2&facet.field=field3

The facet.field parameter identifies a field that should be treated as a facet. It iterates over each Term in the field and generate a facet count using that Term as the constraint. This parameter can be specified multiple times in a query to select multiple facet fields.

您还可以通过 f.<field>.<setting> 语法为每个字段提供单独的设置:

f.field1.facet.prefix=foo