This module's parameter query code does not play well with "filter by taxonomy term id - must not exist" filter or any other filter bringing term_node into the query. The code forgets to use the alias for the table it added. The patch probably fixes this issue. I suspect you may now need to add 'distinct' to the query if you are using "filter by taxonomy term id - must exist" to avoid duplicates, but at least results don't dissappear completely like before. Please review.
example query with similar terms parameter (works):
SELECT node.nid AS nid,
node.title AS node_title,
COUNT(node.nid) AS node_count
FROM drp_node node
LEFT JOIN drp_term_node term_node ON node.vid = term_node.vid
WHERE (node.status = 1) AND (term_node.tid = 2) AND (node.nid != 200)
GROUP BY nid, node_title
ORDER BY node_count DESC
same query with filter by taxonomy term id added, excluding terms (does not work):
SELECT node.nid AS nid,
node.title AS node_title,
COUNT(node.nid) AS node_count
FROM drp_node node
LEFT JOIN drp_term_node term_node ON node.vid = term_node.vid AND (term_node.tid = 568 OR term_node.tid = 10)
LEFT JOIN drp_term_node term_node2 ON node.vid = term_node2.vid
WHERE (node.status = 1) AND (term_node.tid IS NULL) AND (term_node.tid = 2) AND (node.nid != 200)
GROUP BY nid, node_title
ORDER BY node_count DESC
(term_node.tid IS NULL) AND (term_node.tid = 2) is obviously wrong.
Comments
Comment #1
takim commented