The issue is to do with taxonomy arguments combined with relationships. I have a node view set up to return a list of nodes of a specific content type (done via a filter) that have a relationship to another content type, with fields being displayed from both the main content type and the related content type. This works fine, the bug comes up when I introduce a taxonomy argument that is tied to the related content type - for example, list all nodes of content type student that have a related node teacher where the teacher node belongs to a given taxonomy term. The correct nodes are retrieved, however they are duplicated for every taxonomy term that the related node is associated with, regardless of vocabulary. So, if a teacher node was associated with subjects (subjects being one vocabulary) Math and Science and grades (grades being another vocab) 9 and 10, and the term Science was passed into the view as an argument, each student node related to that one teacher would be displayed 4 times in the view.

CommentFileSizeAuthor
#2 exported_view.txt9.07 KBmtovey

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Could you please export the view? So its easier to see, what you did.

mtovey’s picture

StatusFileSize
new9.07 KB

Sure, I've attached the exported view in a text file. Let me know if you need any further information. Thanks.

merlinofchaos’s picture

Can you paste the query this view produces in the Preview?

mtovey’s picture

Following is a sample query produced by the view, when passing in a taxonomy term argument. Let me know if you need anything further. Thanks.

----------------------

SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_docket.field_docket_value AS node_data_field_docket_field_docket_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_docket.field_petitioner_value AS node_data_field_docket_field_petitioner_value,
node_data_field_docket.field_respondent_value AS node_data_field_docket_field_respondent_value,
node_data_field_decision.field_decision_value AS node_data_field_decision_field_decision_value,
node_data_field_decision.delta AS node_data_field_decision_delta,
node_data_field_granted.field_granted_value AS node_data_field_granted_field_granted_value,
node_data_field_granted.delta AS node_data_field_granted_delta,
node_node_data_field_case_node_data_field_argument.field_argument_value AS node_node_data_field_case_node_data_field_argument_field_argument_value
FROM node node
LEFT JOIN content_field_case node_data_field_case ON node.vid = node_data_field_case.vid
INNER JOIN node node_node_data_field_case ON node_data_field_case.field_case_nid = node_node_data_field_case.nid
LEFT JOIN term_node node_node_data_field_case__term_node ON node_node_data_field_case.vid = node_node_data_field_case__term_node.vid
LEFT JOIN term_node node_node_data_field_case_node_node_data_field_case__term_node ON node_node_data_field_case.vid = node_node_data_field_case_node_node_data_field_case__term_node.vid
INNER JOIN term_data node_node_data_field_case__term_data ON node_node_data_field_case__term_node.tid = node_node_data_field_case__term_data.tid
LEFT JOIN content_type_case node_data_field_docket ON node.vid = node_data_field_docket.vid
LEFT JOIN content_field_decision node_data_field_decision ON node.vid = node_data_field_decision.vid
LEFT JOIN content_field_granted node_data_field_granted ON node.vid = node_data_field_granted.vid
LEFT JOIN content_field_argument node_node_data_field_case_node_data_field_argument ON node_node_data_field_case.vid = node_node_data_field_case_node_data_field_argument.vid AND node_node_data_field_case_node_data_field_argument.delta = 0
WHERE (node.type in ('media_item')) AND (UPPER(node.title) LIKE UPPER('%argument%')) AND (node_node_data_field_case__term_data.name = '1988')
ORDER BY node_node_data_field_case_node_data_field_argument_field_argument_value DESC

merlinofchaos’s picture

I know that you marked this issue as being against Views 2.8, but that *really* looks like #648438: Relationship aliases not recorded, leading to bogus JOINs when adding certain sorts which is fixed in Views 2.8 -- are you absolutely sure you have Views 2.8?

mtovey’s picture

After checking, I found that Views 2.6 was installed. However, after upgrading to 2.8, the issue still remains. Following is the query that is produced under 2.8

--------------------------------------------------------------------------------------------------

SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_docket.field_docket_value AS node_data_field_docket_field_docket_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_docket.field_petitioner_value AS node_data_field_docket_field_petitioner_value,
node_data_field_docket.field_respondent_value AS node_data_field_docket_field_respondent_value,
node_data_field_decision.field_decision_value AS node_data_field_decision_field_decision_value,
node_data_field_decision.delta AS node_data_field_decision_delta,
node_data_field_granted.field_granted_value AS node_data_field_granted_field_granted_value,
node_data_field_granted.delta AS node_data_field_granted_delta,
node_node_data_field_case_node_data_field_argument.field_argument_value AS node_node_data_field_case_node_data_field_argument_field_argument_value
FROM node node
LEFT JOIN content_field_case node_data_field_case ON node.vid = node_data_field_case.vid
INNER JOIN node node_node_data_field_case ON node_data_field_case.field_case_nid = node_node_data_field_case.nid
LEFT JOIN term_node node_node_data_field_case__term_node ON node_node_data_field_case.vid = node_node_data_field_case__term_node.vid
LEFT JOIN term_node node_node_data_field_case_node_node_data_field_case__term_node ON node_node_data_field_case.vid = node_node_data_field_case_node_node_data_field_case__term_node.vid
INNER JOIN term_data node_node_data_field_case__term_data ON node_node_data_field_case__term_node.tid = node_node_data_field_case__term_data.tid
LEFT JOIN content_type_case node_data_field_docket ON node.vid = node_data_field_docket.vid
LEFT JOIN content_field_decision node_data_field_decision ON node.vid = node_data_field_decision.vid
LEFT JOIN content_field_granted node_data_field_granted ON node.vid = node_data_field_granted.vid
LEFT JOIN content_field_argument node_node_data_field_case_node_data_field_argument ON node_node_data_field_case.vid = node_node_data_field_case_node_data_field_argument.vid AND node_node_data_field_case_node_data_field_argument.delta = 0
WHERE (node.type in ('media_item')) AND (UPPER(node.title) LIKE UPPER('%argument%')) AND (node_node_data_field_case__term_data.name = '1988')
ORDER BY node_node_data_field_case_node_data_field_argument_field_argument_value DESC

merlinofchaos’s picture

Hm. Be sure to clear all your caches. With 2.8 that query should have one less join.

mtovey’s picture

I've cleared my caches (via the 'Flush all Caches' admin function) and double checked that Views 2.8 is installed on our site. I'm still seeing the original issue where multiple entries are being generated based on the total number of taxonomy terms the related node belongs to. Let me know if you need any further info re this.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Active
dawehner’s picture

@mtovey

Did you cleared views caches too on admin/build/views/tools

Alterernative you could check whether this is still an issue.

iamjon’s picture

Status: Active » Postponed (maintainer needs more info)

setting this to postponed

iamjon’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)