A number of Views combined fields filter operators are currently pointless to an end user

Created on 13 October 2016, almost 8 years ago
Updated 4 May 2023, over 1 year ago

Problem/Motivation

The combined field filter has a large number of operators, most inherited from \Drupal\views\Plugin\views\filter\StringFilter.

Most of these are currently pointless or don't do what an end user would expect. Most of these you would expect to check the individual field values, not the whole concatenated string, but:

  • Is equal to => Works on the whole concatenated string, not its parts
  • Is not equal to => Works on the whole concatenated string, not its parts
  • Contains => Winner! This is the reason this filter exists and it rules.
  • Contains any word => Works
  • Contains all words => Works
  • Starts with => Works on the whole concatenated string, not its parts
  • Does not start with => Works on the whole concatenated string, not its parts
  • Ends with => Works on the whole concatenated string, not its parts
  • Does not end with => Works on the whole concatenated string, not its parts
  • Does not contain => Works
  • Length is shorter than => Works on the whole concatenated string, not its parts
  • Length is longer than => Works on the whole concatenated string, not its parts
  • Regular expression => Who knows what people will dream up
  • Is empty (NULL) => Never true, it's a concatenated string containing spaces
  • Is not empty (NOT NULL) => Always true, it's a concatenated string containing spaces

So, for example, using Start with, leads to a where clause like this:
AND ((CONCAT_WS(' ', node_field_data.title, ' ', node_field_data.type, ' ', users_field_data_node_field_data.name) LIKE 'something%'))

The concat_ws trick works nicely for 'contains' but for everything else, you need to do something else to test all the field values individually.

Proposed resolution

Take them out? Too late for that I guess, so make them work in a sensible way.

Remaining tasks

Discuss a way forward and implement it.

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
ViewsΒ  β†’

Last updated about 12 hours ago

Created by

πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

Production build 0.71.5 2024