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.


  • 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


Although a very late answer but maybe it helps somebody. Here's a great write up with the solution to above use case: How to combine two facets


I fact all you need is

hook_facet_items_alter(&$build, &$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';

The link in the accepted answer is no longer working, so I don't know how it accomplished the task. But for anyone else trying to solve this issue, I used hook_facetapi_realm_info() to create a realm, hook_facetapi_widgets() to alter the html output from the link, hook_facetapi_url_processors() to define an url processor based on facetapi pretty paths. The whole module can be found here: https://github.com/Coyote6/drupal-7-combined-facet-block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.