Can only filter view by nid when using EH root relationship

Created on 5 December 2021, almost 3 years ago
Updated 14 June 2024, 4 months ago

Problem/Motivation

hi
after adding Root relationship(Top), it's not possible to add a Content type of TOP inside "Filter criteria" or "Fields"

need help please

πŸ› Bug report
Status

Active

Version

3.0

Component

Code (module)

Created by

πŸ‡§πŸ‡―Benin delacosta456

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States byrond

    We experienced the same thing. When using the relationship to get the root entity of the hierarchy, we are unable to filter by anything related to the root (title, content type, etc.). We only have access to the nid of the root node. We tried also adding a relationship to "get the actual content of the node revision" based on the root (Top) relationship, but there is no vid to join by.

  • πŸ‡ΊπŸ‡ΈUnited States byrond

    Here is an example Views query:

    SELECT DISTINCT "node_field_data"."created" AS "node_field_data_created", "node_field_data"."nid" AS "nid", "eh_for_node_field_data"."nid" AS "eh_for_node_field_data_nid"
    FROM
    {node_field_data} "node_field_data"
    INNER JOIN (SELECT "eh_child"."id" AS "eh_child_id", "eh_child"."revision_id" AS "eh_child_revision_id", "eh_parent"."id" AS "nid"
    FROM
    {nested_set_field_book_page_parent_node_node} "eh_child"
    INNER JOIN {nested_set_field_book_page_parent_node_node} "eh_parent" ON (eh_child.left_pos BETWEEN eh_parent.left_pos AND eh_parent.right_pos) AND eh_parent.depth = 0) "eh_for_node_field_data" ON node_field_data.nid = eh_for_node_field_data.eh_child_id AND eh_for_node_field_data.eh_child_revision_id = node_field_data.vid
    WHERE ("node_field_data"."status" = '1') AND ("node_field_data"."langcode" IN ('***LANGUAGE_language_interface***')) AND ("eh_for_node_field_data"."title" LIKE 'Some title' ESCAPE '\\')
    ORDER BY "node_field_data_created" DESC

    And the error when trying to use the relationship to filter by a field on the related node:

    SQLSTATE[42S22]: Column not found: 1054 Unknown column 'eh_for_node_field_data.title' in 'where clause'

  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Can you share the yml for your view?

Production build 0.71.5 2024