Hi David, contributors..
First of all, thank you for an amazing module. It came at a time that I was in despair over the views filtering and search modules not providing me with an intelligent and intuitive interface.
Faceted Search is AWESOME! And not only that, it's well documented, the Readme.txt would probably win #1 prize in a "Best Module Readme File" competition. The code is also very well documented, congrats guys! :)
Anyway I found an issue where updating the terms of a node with a hierarchical vocab would not update the facets on the faceted search page, but changes to the terms from a flat vocab do appear.
I see in the code and from the issue http://drupal.org/node/230675 that this is by design, and I should just call _taxonomy_facets_update manually, but the question I have is why does it work for flat vocabs automatically but not for hierarchical ones?
Thanks again
Mark
Comments
Comment #1
David Lesieur commentedGlad you like the module! (and its documentation!)
Associations to terms from flat vocabularies are immediately effective in the Guided search because in this case the core term_node table is used, and that table is always updated immediately upon saving a node. Associations to terms from hierarchical vocabularies, on the other hand, are looked up in a table that's specific to the Taxonomy Facets module, and that table is only updated on cron runs (its data is derived from the term_node table).
Many people get confused by this, so perhaps Taxonomy Facet's table should also be updated upon saving a node... However, updates on cron will still be needed to account for changes in the vocabularies or the terms themselves, which usually affect many node term associations at a time.
Comment #2
Mark Theunissen commentedOk thanks for the explanation. I have implemented a nodeapi() hook to act on inserts and updates, so all is good!
Comment #3
David Lesieur commentedActually, I had pulled this out because of problems with free tags. However, I'm just realizing that it is safe to assume that taxonomy_nodeapi() would always be called before taxonomy_facets_nodeapi() because of their respective module names. This means that the term_node table is already up-to-date when taxonomy_facets_nodeapi() gets called and that it would be safe to call _taxonomy_facets_update() from there.
It would be a good idea to improve taxonomy_facets_nodeapi() with all this in mind.
Wanna provide a patch so this becomes part of the next release? ;)
Comment #4
Mark Theunissen commentedSure thing, will work it out later.
Comment #5
Mark Theunissen commentedShould we drop the taxonomy_facets_node table?
If so, we need an upgrade path, so I was thinking of doing the following which should provide one:
Is this what you'd prefer? Or leave the table alone and just do the updates in nodeapi() without changing any records?
Comment #6
David Lesieur commentedActually we still need to support cron, because vocabulary changes may affect lots of nodes and we don't want to do such costly updates in one go. For example, changing a term's parent term affects all nodes associated to children of the modified term — all entries of taxonomy_facets_term_node related to those children need to be updated (actually, it is not managed that way since the table is updated in a per-node basis).
To sum it up, the cron stuff and the taxonomy_facets_node table are still needed. We only need taxonomy_facets_nodeapi() to call _taxonomy_facets_update() immediately when a node is created or updated.
Comment #7
David Lesieur commentedI've just committed changes to the module to do this.
Comment #8
Mark Theunissen commentedAaaarrrgghh I completely forgot about this.... sorry!
Drupal.org needs the ability to "star" threads in the tracker so they don't get lost once they become read!
Apologies. I know it wasn't a big change but I meant to do it.
Comment #9
David Lesieur commentedNo problem!
There are plenty of issues left, if you feel an itch for coding. :)
Comment #10
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.