My site uses Search API and Facet API for search.

My user search has several entity references that are also indexed. So, when just two facets are activated, this gives me a URL like this:


This is way too long. What I'd like to do is collapse the field_acc_gen%253Afield_location_taxonomize_terms to co (country) and field_acc_gen%253Afield_languages%3A50 to la (language).

I know that Facet API Pretty Paths can be used to shorten the URLs but because I have about 20 facets, the regex that it uses seems to really kill performance. I am also thinking about using Search API Page, which does not work with FacetAPI Pretty Paths. So, I was hoping to find a way to rename the facets themselves in code.

I have my facets exported using the Features module. I tried changing $facet->name, but this had no affect on the results:

  $facet->name = 'search_api@om_user_search::field_acc_gen:field_language';
  $facet->searcher = 'search_api@om_user_search';
  $facet->realm = '';
  $facet->facet = 'field_acc_gen:field_language';


  $facet->name = 'search_api@om_user_search::la';

How can I programmatically rename a facet?

1 Answer 1


You want facetapi_alias.

The facets already have a setting "facet alias" internally, which can be different from the facet machine name. But this setting is not exposed in the UI natively.

The FacetAPI Alias module simply exposes this setting on the facet display form.

If you want more advanced solutions, you could use facetapi pretty paths (as you mentioned), or write your own FacetapiUrlProcessor. I have done the latter, and I can tell you it was painful :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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