nir
nir

Reputation: 3868

solr facet - count of terms across multiple fields

Is there a way to run facet query on multiple fields and get total count of each terms across those fields. Currently when I use facet.field=NAME&facet.field=TITLE then my result set have separate count of terms for each. e.g. computer,2000 for NAME fields and computer,500 for TITLE. Is there a way to get computer, 2500 ?

Upvotes: 0

Views: 489

Answers (1)

The Bndr
The Bndr

Reputation: 13394

On way (not sure if it's the best way) is to create an copyfield and merge Title and Name into that field. something like this in your schema.xml

 <field name="FCOUNT" type="string" indexed="true" stored="false" multiValued="true"/>
  [...]
 <copyField source="NAME" dest="FCOUNT"/>
 <copyField source="TITLE" dest="FCOUNT"/>

Now you can use facet.field=FCOUNT

Upvotes: 2

Related Questions