I use the synonyms module in several Drupal websites. This excellent, simple module allows you to define multiple synonyms for each taxonomy term. There are various reasons why you may want to do this, but the main reason for me is to allow searches for synonymous taxonomy terms to all return the same set of matching node results.
For example, on the www.teenagehealthfreak.net website, young people can search for health information on a number of topics. Considering the nature of medical taxonomy, and the target audience, we wanted to include a wide variety of synonym, slang, and misspelled versions of each taxonomy term. That way, searches for “acne”, “blackheads”, “zits”, etc. all return the page about spots (which is tagged with the primary term “spots”, to which all those synonyms are attached), even if none of those alternative words are actually used on the page itself.
One problem I came across when using the synonyms module is the snippet of text displayed in the search results listing, which is created by the core search module’s search_excerpt() function. By default, search_excerpt() scans the text of the node and creates a snippet highlighting the matching text found from the search input. However, when using the synonyms module, the supplied search input might not actually appear anywhere in the text of a node at all (since it may just be a synonym of a term that is attached to the page). In these cases, the search result listing was just displaying ‘…’
There is no way of overriding search_excerpt(), and there is no search_excerpt_alter() function that I could find, so instead I used template_preprocess_search_result() to modify search results that had ‘…’ snippets to instead include the first 160 characters of the body text of the relevant node, which is available in the $variables[‘result’][‘node’] object, as follows: