I think this bug has something to do with how similarterms retrieves the latest revision ID. If you've enabled "Create new revision" for a node type, then similarterms doesn't pick up the latest revision ID. When you add new terms to a node, they're only added to the latest revision, which means similarterms essentially ignores them.

I fixed the issue by changing line 85 of the file views/similarterms_handler_argument_node_nid.inc to the following

$vids[] = db_result(db_query("SELECT vid FROM {node_revisions} WHERE nid = %d ORDER BY vid DESC LIMIT 1", $nid));

Let me know if you'd like me to submit a patch.

CommentFileSizeAuthor
#2 similarterms-969034.patch951 bytesLes Lim
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brad.bulger’s picture

why not just get the latest version id from node?

Les Lim’s picture

Priority: Normal » Critical
Status: Active » Reviewed & tested by the community
FileSize
951 bytes

#1 is the right way to go. Patch attached. I think this is straightforward enough that it doesn't have to go through the usual review, so setting to RTBC.

I'd also call this borderline critical, so bumping the status.

jjeff’s picture

Patch looks good. Thanks for this.

I'll probably be able to integrate and commit this tomorrow.

dsayswhat’s picture

Title: Fetching incorrect revision ID » Empty similarterms block: No records returned due to fetching incorrect revision ID

I just arrived at the same conclusion - but didn't see this issue until too late. my problem was that the similarterms block was showing intermittently empty on random nodes, like described in #973670: Views block doesn't output any similar nodes and #959638: Block not appearing when expected.

If anyone is seeing empty similarterms blocks, the patch above should make all the difference.

If it's all right, I'll change the title to reflect both the symptom and the cause, for future reference.

Thanks for a great module, Jeff.

jjeff’s picture

Status: Reviewed & tested by the community » Fixed

Patch applied and new version (2.1) released!

Status: Fixed » Closed (fixed)

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