Tag synonyms are a popular, important feature in many sites (used here on StackExchange, for example), and taxonomy synonyms used to be part of Drupal 6's core Taxonomy module, before being dropped in favor of "Roll your own" custom synonym systems made using Field API.

When synonyms work reliably, they are extremely useful in search; for example, to make sure that searches for "America" find content tagged "USA", etc. However, I can't find any leads on what the standard method is for implementing this feature when working with the popular Search API - Facet API family of related integrated search modules, for Node searches.

"Going with the flow" is important when working with clusters of modules like this, to make sure that systems you implement don't go against the grain of the thinking of the community and module maintainers. When they do go against the grain, they are flakey and risk being broken by future changes to these modules.

What is a reliable/robust/standard/expected method for implementing taxonomy synonyms in D7 for sites using Search API? (in particular, with Search API Solr, but I would hope that Search API's attempts to abstract out the particular search provider would work in this case).

If you have a system for this that seems to work, but it's something you figured out and you aren't sure if it is or isn't against the grain (pretty common in Drupal), please do share it anyway with information from your testing, usage and experience on which features and modules in the Search API-Facet API family it does and doesn't work well with.

Some plausible but potentially flakey options I've found in research:

  • There's a D7 Search Synonyms module, but it looks to be little used, and there's no confirmation it works or will continue to work with 3rd party search modules like Search API (it's designed with Drupal core search in mind). Edit: also doesn't look to be too reliable in D7 in general.
  • It's theoretically possible to add a term reference field called "Synonyms" to a Taxonomy vocabulary, and index this field from the term in Search API with equal weight to the term on the node itself. This would work for text searches, but feels like a shallow MacGuyver-y duct-tape solution rather than something robust that smoothly slots in to the whole Search API family. For example, if a term "United Kingdom" has a synonym "Britain", someone searching on 'Britain' would get results tagged with United Kindgom, but someone typing "Britain" into an autocomplete Taxonomy exposed filter or selecting Britain with a Taxonomy fact would not see any content tagged with "United Kingdom".*****
  • Another similar possibility is adding a multi-value plain text field "Synonyms" to the term vocabulary (or even comma-separated, I guess), and indexing it with the same weight as the term name as above. But this has similar, if not worse, issues to the above in the above example, "Britain" wouldn't even be listed as an option in a facet or exposed filter. There might be some way to create a composite field by combining name and synonyms ( "United Kingdom (Britain, UK)" ), and set facets/exposed filters/etc to use that ... but I can't think of any way to do this that isn't worryingly hacky and that doesn't feel worryingly against the grain. Edit: Search API Combined seems designed for something like this, but I'm not sure how heavily tested or integrated it is across the Search API family.
  • Then there's the last resort option of just cramming everything into the term name: it should be clear that this isn't desirable and would in many cases make for very ugly lists (e.g. imagine a navigation list of countries that were written out like "North Korea (PRK, DPRK, Democratic People's Republic of Korea)"... ). Or having a "Display name" field that shows the short version, and setting everything except search (all Views, Pathauto, every other contrib/core module that uses the term name) to use this instead of the term name... again, very hacky and very against the grain.
  • Apache Solr has a Synonyms feature, where a text file of synonyms is read and these terms are treated as synonymous across searches that use it. However, while possible in a Search API setup that uses Solr, this is considered by the module maintainers to be unsupported 'attempt at own risk' advanced Solr configuration. Also, it's more appropriate for generic synonymy in the language of the site than synonymy specifically in the context of a taxonomy. For example, a site with a taxonomy that doesn't discriminate England, Scotland etc from Britain might want to consider them synonymous in the context of tagging, but not synonymous in the context of searches on body text. Edit: The head Facet API maintainer warns against this route as Solr integration modules work with terms as TIDs not text.

I'm aware that this is a flawed example because in the case of UK/Britain, and countries in general, people are used to using lists that only have one or the other. There are plenty of less simple cases (e.g. product categories) where people wouldn't think to look for a synonym.

Update: Relevant info in a new thread on Drupal.org Facet API queue. Also a (currently unanswered) thread on Search API queue.

(any rules lawyers wondering if it's okay for there to be drupal.org support requests and drupal answers questions on the same topic: yes, it is, in fact it's encouraged to take the pressure off module maintainers)

  • 1
    did you find the solution to this ? I have this exact problem now.
    – vishal
    Commented Mar 6, 2014 at 17:21

1 Answer 1


I have been using bojanz's excellent Synonyms module. It is a complete re-write of the D6 synonyms function, with a number of new bells and whistles. Looks like it might do most of what you need.

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.