Taxonomy facets is returning results from previous node revisions.

What I mean is that if I create a node and assign it some taxonomy values from a non-hierarchical vocabulary, and then save a new revision of the node with different taxonomy values, when I do a faceted search on that node, I get results as if all taxonomy terms from all revisions are still attached to that node.

The reason is that the query generated by taxonomy facets joins to the {term_node} table only on nid and doesn't include the revision ID of the node.

I'm making a patch... will attach shortly.

CommentFileSizeAuthor
#1 1034006.patch836 bytesjhodgdon

Comments

jhodgdon’s picture

Status: Active » Needs review
StatusFileSize
new836 bytes

Here's a patch against 6.x-1.0-beta2, but I think it will also apply to HEAD. With this patch, my client's site is now working correctly.

Basically the patch just uses array('nid', 'vid') as the join condition in taxonomy_facet_category::build_results_query(), rather than just 'nid'.

Incidentally, it looks like the count queries were fine as they were, so you might see for instance that a certain facet was supposed to have 2 results, then when you clicked it you found 4 results on the screen.

YK85’s picture

subscribing

jhodgdon’s picture

I just used this patch on another site that had this same problem. Any chance we could get it added to the Faceted Search module?

DalSegno’s picture

Subscribing

kristi wachter’s picture

Priority: Normal » Major
Status: Needs review » Reviewed & tested by the community

This fixed a similar problem for me.

(One term facet had a count of 16 nodes, but when you clicked the term, you got more than 40 results!)

It would be great to get this committed.

Thanks!

David Lesieur’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.