Entity References do not work as expected with Global: Combine fields filter (exposed)

Created on 11 March 2015, almost 10 years ago
Updated 20 April 2023, over 1 year ago

Problem/Motivation

As the title says, combined fields filter not working with entity reference. Firstly, passed values are something, starting with node ids (but, strangely, not exatly them!). Secondly, even if I use "Starts with" filter and enter node id, I get items, corresponding to only one field, but not to all, that I declared. So?

Steps to reproduce

Proposed resolution

Remaining tasks

Needs steps to reproduce
Search for duplicate issues

User interface changes

API changes

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

9.5

Component
ViewsΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡·πŸ‡ΊRussia miha64

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 w01f

    Just responding to the above, still an issue on Drupal 10.0.7.

    Steps to reproduce:

    1. Add a reference field to a content type or user. I have tested with taxonomies.
    2. Create a view for that content type or for users.
    3. Add some easily referenceable field for the entity - default title, nid/uid, etc.
    4. Add the reference field as a field for the view - it doesn't matter if you eventually want to exclude it from display or not.
    5. Add a combine fields filter as a filter for the view.
    6. You will not see the entity reference field as an option to add and search by.

    Adding the entity reference as a relationship and then adding the term name, etc. does work and allows you to add it to the combine fields filter - but as noted, this can cause headaches with duplicated content as aggregation and other methods are currently not able to resolve this, especially if you're attempting to use view groupings, etc.

    Currently the best workaround is in comment #21, though also as mentioned this isn't an ideal fix, and has the issue where changing terms/values won't be reflected in the view as the computed field is just saving a static copy/snapshot of the values of included entity reference fields upon hitting save on that entity at that time.

  • Status changed to Active over 1 year ago
  • πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

    With the way the combined field filter works, filtering is done at the SQL level, this will only ever work with adding a relationship and adding the entity label/field you actually want to search, that is how it was designed.
    And yes, that will give duplicate rows in some cases, that is just how SQL works.

    If you want it to behave differently, try a different (non-SQL) search backend. Solr + 'Full text search' works like this.

    Since this works as designed, I was split between 'Closed (works as designed)' or moving to feature request. I'll go for Feature for now, since, sure, it would be nice if you could do this.

Production build 0.71.5 2024