I have just tested modifying the call to taxonomy_node_save($node, $terms) with $node->taxonomy = $terms and have perfect results. This is also more efficient since taxonomy_node_save removes all rows from {term_data} before inserting the new data because the taxonomy module already calls taxonomy_node_save, these rows are being removed and created twice per node_save().

Comments

sdrycroft’s picture

Status: Active » Closed (works as designed)

This depends on the order that the modules are executed. It's not a huge performance hit (if any) to call the function, so I'll be leaving it in.

Anonymous’s picture

Status: Closed (works as designed) » Active

It is always a performance hit. If a node contains 10 taxonomies then there are 10 rows deleted and 10 rows added for each call to taxonomy_node_save(). The taxonomy_node_save() is called and should only be called by the taxonomy module. Since taxonomy is later in the alphabet sort than autotag the default module weight of zero ensures that autotag will run before the taxonomy module by default. The caveat would be that those who know how to modify the module weight need to know that autotag must run before taxonomy. This isn't a feature request, it is code improvement that must happen. Therefore, I'm stating that your ``by-design'' is incorrect design.

sdrycroft’s picture

Status: Active » Closed (fixed)
Anonymous’s picture

You force me to create a duplicate module just for this issue. Can we come to consensus on this?

sdrycroft’s picture

Autotag is actually weighted as taxonomy weight +10. This is so that it can alter the taxonomy form fields using hook_form_alter. You therefore can't set a node's taxonomy simply using $node->taxonomy, and relying on the taxonomy module (it has already been executed by the time autotag_nodeapi is executed).

Anonymous’s picture

Title: Use of taxonomy_node_save is unnecessary. » Split UI and DB into separate modules.
Category: task » feature
Status: Closed (fixed) » Active

Ah, I didn't know that. Would you be willing to split the UI and the DB functions into separate modules? I have no reason to use the UI parts of this module. I do have a reason to autotag the feedapi data I receive. Because all of the data for the site is created by feedapi with the potential for several hundred feeds I need the auto tagger to be as efficient as possible. The UI module would then be weighted +10 and the DB module would weighted with the default. Then my original idea would be valid.

sdrycroft’s picture

Status: Active » Closed (works as designed)
Anonymous’s picture

Status: Closed (works as designed) » Active

Not accepting this feature will force me to fork your work. We really don't want to do that.

sdrycroft’s picture

Status: Active » Closed (fixed)

Fork away fella, fork away!