This patch inserts a taxonomy term's synonyms into a nodes search index, thus allowing these synonyms to also be found by the drupal search engine. A simple but much needed implementation of this would be for an ecommerce site listing products under the term 'sofa', this site can now return results to their visitors when they search for 'love seat', 'couch' etc. There are a hundred different ways that it can be useful. Its a 4 line patch that adds much desired usability.

Topics pertaining to the feature request:
http://drupal.org/node/146325
http://drupal.org/node/142775

Blake Lucchesi
www.boldsource.com

Comments

BlakeLucchesi’s picture

StatusFileSize
new775 bytes

Typo in the first submitted patch, my apologies.

robertdouglass’s picture

Status: Reviewed & tested by the community » Needs work

Please remove the tabs and replace them with spaces (as per coding standards... best to have this configured in your editor/IDE). Also, it is not common practice to set one's own patch to RTBC as this bypasses peer review.

I urged Blake to submit this patch and think that this is a really handy way to make the interaction between search and taxonomy a little bit more meaningful (plus it gives synonyms a *real* purpose in core).

BlakeLucchesi’s picture

Status: Needs work » Needs review
StatusFileSize
new784 bytes

Thanks for the comment, I'm sure I'll get the hang of things by the end of Summer of Code haha.

robertdouglass’s picture

Status: Needs review » Reviewed & tested by the community

Thanks. Looks good to me.

bennybobw’s picture

I've tested this patch and it looks good.
+1 on this feauture. I would like to be able to search by synonym.

douggreen’s picture

I'm concerned about the performance hit this will put on search indexing for sites that don't need it. If I have a site and/or taxonomy that doesn't use synonyms, don't we end up with an extra query for every taxonomy term in every node?

robertdouglass’s picture

@Doug, only at indexing time. The alternative would be to have a variable that prevents this indexing and an admin interface that lets you choose whether or not to index it. These would have a bigger performance impact on day-to-day operations (more code parsed, bigger $conf variable in memory). I personally wouldn't mind having taxonomy_get_synonyms run once per node on my site in order to get this feature. I think the feature is super handy.

douggreen’s picture

My point is that if you don't use synonyms on your site, it's going to do the queries anyways.

Why put this in core? Can't we just have a contrib module that implements an 'update_index' nodeapi hook, and add it there? This way, the extra queries would only done if the site administrator has installed and enabled the module, presumably because they have taxonomies with synonyms.

The only reason I'm pushing back is because I never use synonyms. d.o doesn't use them either. Search indexing is slow enough.

robertdouglass’s picture

Valid points. I'll let others weigh in on whether this makes a compelling core feature. In my mind, this would be the first reason to use synonyms and I'm not terribly worried about the overhead of indexing. But you can certainly implement this as a contrib module.

BlakeLucchesi’s picture

Status: Reviewed & tested by the community » Active

Perhaps it might be a simple check box we add to the administrative interface of search.module so that users can select if they want taxonomy synonyms inserted in the index? It seems like that may be the best of both worlds, although you still get a query to the variables table each time a node is indexed...

robertdouglass’s picture

Status: Active » Closed (won't fix)

No, I think that either it should be a core feature by default or a contrib module. The code freeze is passed, so let's just decide it should be a contrib module (you have most of one written, anyway).

BlakeLucchesi’s picture

no prob, I can release it as a contrib, will have it all ready by the weekend.

balsama’s picture

What ever happened to this module? Did it ever get released as a separate module?

UPDATE: (for anyone that stumbles upon this thread)
http://drupal.org/project/synonyms