How can I merge or combine facets? I have a search page with a faceted filter on 'Content Type' field.

I basically need to merge some of the content types into one single facet.

Example:


Content Type A
Content Type B
Content Type C


Should be turned into:


Content Type AB
Content Type C


How can I achieve this?

My Drupal setup for this scenario is the following:

Search API + Search API Solr + Facetapi + Views
I fact all you need is

hook_facet_items_alter(&amp;$build, &amp;$settings);

There you can change the queries and hide/show other facets like


      $build['A']['#markup'] = 'NewA';
      $build['A']['#count']  = $build['A']['#count'] + $build['B']['#count'];
      $size = count($build);
      $build['A']['#query']['f'][$size] = 'field_filter:B';