During testing I purged all of the ~400 nodes via views_bulk_operations, resulting in the term_node table also being purged. However, term_node_count still retained all of its data.

Comments

archard’s picture

Hi, sorry for taking so long to get to this. Term Node Count relies on Drupal's hook system to determine what action to take. I am not familiar with how View Bulk Operations works, but most likely it purges nodes without using the proper drupal functions, and thus no 'delete' hook gets fired, and Term Node Count isn't aware of the changes. If this is not the case, let me know.

Also, it is perfectly OK for term_node_count to retain a record for each term even if there are no records in the term_node table. That simply means that all the records in term_node_count will be 0. It's only when a term is deleted will the corresponding record in term_node_count be removed.

dankohn’s picture

I'm having the same issue where the Term Node Count field sees less nodes than exist (e.g., 0 instead of 1). I believe this occurred either from deleting content with Views Bulk Operations (an incredibly powerful module) or by using Taxonomy Manager to merge terms.

Now that my data is inconsistent, how can I replace it? I tried both emptying and deleting the node_term_count table, but the module did not rebuild the table. How do I get it to?

archard’s picture

Completely uninstall and reinstall the module and the data will return to proper form.

ahjota’s picture

Views Bulk Operations uses either Actions or implementations of hook_node_operations() and hook_user_operations(). So yes, VBO does uses proper Drupal functions. It is possible, of course, that an implemented "delete node" operation will do so improperly. However, the OP probably uses the default "delete node" action provided by Drupal core; I know I do.

http://drupal.org/project/views_bulk_operations

Disclaimer: I'm only commenting on this because I'm reviewing the issue queue for this module before I test it out.

fasdalf@fasdalf.ru’s picture

I think i found a reason. We have a function term_node_count_nodeapi() in this module. It's called many times during batch operations, so static $saved_tids; may keep data of other node.