Indexing options for taxonomy

David Lesieur - August 19, 2006 - 22:33
Project:Drupal
Version:7.x-dev
Component:search.module
Category:feature request
Priority:normal
Assigned:Unassigned
Status:patch (code needs work)
Description

For one of my projects, I need taxonomy terms to get very high scores in the search index. The current default is to assign taxonomy terms the same ranking as <strong> text, and the user cannot change this default.

This patch adds a new group of options to the vocabulary form (see the snapshot). These let the user choose what kind of ranking the terms should get, or decide to not index the terms at all.

Similar options are offered for synonyms (hey, nice to use them!), parent terms, and synonyms of parent terms.

Say I have a term "Montréal", with "Québec" as parent, which in turn has "Canada" as parent. When a node uses the term "Montréal", I want "Québec" and "Canada" to be indexed as well, but with a lesser ranking. These options let me do that.

Now, I'm not sure the average Drupal user cares about such options, that's why I made them collapsed by default. If people believe this does not belong to taxonomy.module, I'll be glad to move it to an external module given some way to override function taxonomy_node_update_index().

Improvement suggestions are also welcome. ;-)

AttachmentSize
indexing_options.png17.61 KB

#1

David Lesieur - August 19, 2006 - 22:34

Now the patch.

AttachmentSize
indexing_options.patch8.81 KB

#2

chx - August 19, 2006 - 22:55
Component:taxonomy.module» search.module

I massively like this patch. Some Drupal users, indeed, may not care. But some may :)

But, of course, the final decision is of Steven's, as this more belongs to search than taxonomy and I recategorized as such.

#3

David Lesieur - August 20, 2006 - 19:38

Changed three lines that did not comply with coding standards.

AttachmentSize
indexing_options_0.patch8.81 KB

#4

David Lesieur - December 23, 2006 - 11:49
Version:x.y.z» 6.x-dev

Updated for latest HEAD.

AttachmentSize
indexing_options_1.patch12.74 KB

#5

David Lesieur - January 29, 2007 - 04:42

Anyone else interested in reviewing this patch before someone rewrites the search module? :-) The patch still applies, for now.

#6

guardian - June 2, 2007 - 17:22

subscribing

#7

David Lesieur - August 3, 2007 - 14:16
Version:6.x-dev» 7.x-dev

#8

Benjamin Melançon - October 15, 2007 - 17:46

Subscribing.

See also http://drupal.org/project/synonyms for a current (Drupal 5) implementation of part of this request.

#9

birdmanx35 - February 2, 2008 - 19:51
Status:patch (code needs review)» patch (code needs work)

No surprises here, but this fails against HEAD:

$ patch -p0 < indexing_options_1.patch
patching file modules/taxonomy/taxonomy.module
Hunk #1 FAILED at 271.
Hunk #2 FAILED at 331.
Hunk #3 FAILED at 360.
Hunk #4 FAILED at 373.
Hunk #5 succeeded at 1240 (offset -121 lines).
4 out of 5 hunks FAILED -- saving rejects to file modules/taxonomy/taxonomy.module.rej
patching file modules/search/search.module
Hunk #1 succeeded at 1171 (offset 59 lines).
patching file modules/system/system.install
Hunk #1 FAILED at 578.
Hunk #2 FAILED at 1048.
Hunk #3 succeeded at 2475 with fuzz 2 (offset -1013 lines).
2 out of 3 hunks FAILED -- saving rejects to file modules/system/system.install.rej

#10

David Lesieur - February 12, 2008 - 15:29

It doesn't feels like this feature has raised enough interest to justify updating the patch for D7...

Rather than implementing this specific logic, it might be preferable to just give a way for modules to override taxonomy_node_update_index().

#11

robertDouglass - April 15, 2008 - 06:08

I like the concept. However, I think the form should be implemented via form_alter and not with an if(module_exists('search')).

 
 

Drupal is a registered trademark of Dries Buytaert.