Closed (fixed)
Project:
Drupal core
Version:
4.6.0
Component:
taxonomy.module
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
9 May 2005 at 21:39 UTC
Updated:
4 Jun 2005 at 11:59 UTC
Jump to comment: Most recent file
When asking for a list of nodes linked to more than one term by using the syntax 'taxonomy/term/x+y', the same nodes are shown twice instead of only one time, when nodes are linked to both x and y term.
Hoping I've been able to explain what happens.....
Matteo
PS: Maybe is it so by design.... ??
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | taxonomy_distinct.patch | 1.06 KB | matteo |
Comments
Comment #1
matteo commentedIt looks like a distinct(n.nid) clause should be added to lines 839-840, which should sound like this:
$sql = 'SELECT distinct(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC';
$sql_count = 'SELECT COUNT(distinct(n.nid)) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1';
this prints out the correct number of nodes.
Matteo
Comment #2
jonbob commentedI think your analysis is right. The DISTINCT() was probably removed because someone thought it was there for node permissions (the new db_rewrite() mechanism handles this now), but it is also necessary in the case of an OR query.
Comment #3
Cvbge commentedHello,
I've used proposed change and it works as expected.
Comment #4
matteo commentedJust to undesrtand what to do, should I create the patch, or is it assigned to someone else ??
Matteo
Comment #5
matteo commentedHere is the patch for Drupal 4.6 to solve this problem.
Matteo
Comment #6
dries commentedCommitted to HEAD and DRUPAL-4-6. Thanks.
Comment #7
(not verified) commented