I've installed the last stable version of this module, but when I enter in one of my page node the block of similar terms display me nly one result.
I've noticed that it display only the first result of the query even if I have more than one page node that have the same taxonomy term.
somebody can help me?
thanks!

Comments

dotsam’s picture

I have the same issue

thedavidmeister’s picture

i'm having the same issue. It started as soon as i upgraded to views 3

thedavidmeister’s picture

further information: disabling the similar by terms sort allowed me to control the number of items displayed.

removing the field, and the argument both did nothing.

thedavidmeister’s picture

nope, i can't figure this out.

The query generated using a fixed nid for testing is:

SELECT node.title AS node_title,
node.nid AS nid,
COUNT(node.nid) AS node_count
FROM node node
LEFT JOIN term_node term_node ON node.vid = term_node.vid
WHERE (node.moderate = 0) AND (node.status = 1) AND (term_node.tid IN (660, 3822, 24369, 25020, 27862, 27866, 12223, 27863, 8921, 27864, 758, 12219, 27865, 14586)) AND (node.nid != 161777)
ORDER BY node_count DESC

i tried selecting "use grouping" and "distinct" but these didn't help at all.

BlueBlossom’s picture

subscribing. I am having the same issue ever since I upgraded to Views 3. Plus the results are always the same node - whether it is similar or not.

thedavidmeister’s picture

hrm. This issue totally broke the module, and i'm not in a position to downgrade back to views 2.

doesn't look like we're going to get any help from the module maintainers either since this post is about 6 weeks old now.. how frustrating.

thedavidmeister’s picture

turning the similar by terms sort off at least fixes the number of items issue.

The module can still filter results that share at least one taxonomy term with the current item/argument, but you have to come up with a compromise sort rule.

I ended up sorting by post date. Luckily i had 5 different taxonomies on this particular content type, two of which were set up specifically for relating articles by topic, so the results returned aren't unusable, but they're not really what this module set out to achieve.

tomsm’s picture

Similar by terms 1 is now an unsupported release so I upgraded to version 2.
I have the same issues because I also use Views 3.

tomsm’s picture

Priority: Normal » Major

Setting this to major since SBT1 has become an unsupported release.

kenwen’s picture

same issue here, subscribing

rmiddle’s picture

#9 I moved SBT1 back in to supported status.

Thanks
Robert

Hardrocker’s picture

I agree changing the sort criteria from similar by terms seems to work. Not sure what other issues it will trigger just have to wait and see I guess. What is did for sort criteria was change the values to randomize.

smithmilner’s picture

This is not a proper fix.

function module_views_pre_execute(&$view) {
  $add_group_views = array(
    'name_of_view',
  );
  if ( in_array($view->name, $add_group_views)) {
    $search = '/ORDER BY/';
    $replace = 'GROUP BY nid ORDER BY';
    $view->query->final_query = preg_replace($search, $replace, $view->query->final_query);
  }
}
udvranto’s picture

Same issue here...

udvranto’s picture

Turning off the sort criteria generates a huge list now. :(

smithmilner, in which file did you update the code?

udvranto’s picture

I added the code in sites/all/modules/similarterms/views/similarterms.views.inc . The same problem persists! :(

function similarterms_views_pre_execute(&$view) {
  $add_group_views = array(
    'name_of_view',
  );
  if ( in_array($view->name, $add_group_views)) {
    $search = '/ORDER BY/';
    $replace = 'GROUP BY nid ORDER BY';
    $view->query->final_query = preg_replace($search, $replace, $view->query->final_query);
  }
}
udvranto’s picture

Adding the following in sites/all/modules/similarterms/views/similarterms.views.inc worked like a charm! Thanks smithmilner! :D

function similarterms_views_pre_execute(&$view) {
  $add_group_views = array(
    'similarterms',
  );
  if ( in_array($view->name, $add_group_views)) {
    $search = '/ORDER BY/';
    $replace = 'GROUP BY nid ORDER BY';
    $view->query->final_query = preg_replace($search, $replace, $view->query->final_query);
  }
}
smithmilner’s picture

#13 is a hook, hook_views_pre_execute() to be exact. You can put that into it's own module, just make sure to rename the beginning of the hook accordingly. Also, put the name of your view into the array $add_group_views.

vishnu.kumar7’s picture

Hi Smith... Thanks for the fix but it worked for me partially....It's listing similar terms for one content type (blog)...

http://thinkingparticle.com/blog/kanha-national-park-india-map-pictures

but not listing similar terms for article type of content..

http://thinkingparticle.com/articles/bandhavgarh-national-park-best-chan...

However the block is configured for both pages.... /blog/* and /articles/*...

With previous version of similar by terms.... Similar content block was appearing on both kind of content type... any clue...

Regards
Vishnu Kumar

takim’s picture

Issue summary: View changes
Status: Active » Closed (outdated)