Search code examples
solrfacetfaceted-search

Facet on multiple fields at once and aggregate the results


I have a couple fields that represent error codes, they take the form error_code1, error_code2 ... error_code5.

Is there a way to facet across all of them so that I can get a count of error codes across all of the error code fields?

If one doc has error_code1 = 42 and another has error_code3 = 42, I want to get a count of 2 for error code 42

Thanks in advance


Solution

  • You can create an aggregating field all_errors and use <copyField source="error_code*" dest="all_errors" /> to populate it.