Summary

If a field is excluded from display, but is included in the Combine fields filter, it does not actually get filtered. Various issues may come about, see Related issues.

Steps to reproduce

  1. Create a content type with a Text field
  2. Create a view displaying fields of that content type
  3. Add two fields (e.g. title & text field)
  4. Exclude text field from display
  5. Create Combine fields filter
  6. Expose the filter, Set it as Required
  7. Include both fields to be searched on
  8. Search for a value that is only in the excluded text field
  9. See that the record isn't filtered

Related issues

Background

I first mentioned this issue as a comment in #2373745: Combine fields filter with missing field(s) results in fatal error: Call to a member function ensure_my_table() on a non-object, and decided to separate this as a separate issue.

Suggested solution

Include excluded field data in the search

Comments

rudiedirkx’s picture

Did you actually reproduce this? Because it works fine for me.

  1. I fetch Title and Background color
  2. Exclude Background color
  3. Exposed filter like you describe
  4. Search for "green"

This is the resulting query:

SELECT node.title AS node_title, node.nid AS nid, 'node' AS field_data_field_bgcolor_node_entity_type
FROM {node} node
LEFT JOIN {field_data_field_bgcolor} field_data_field_bgcolor ON node.nid = field_data_field_bgcolor.entity_id AND (field_data_field_bgcolor.entity_type = 'node' AND field_data_field_bgcolor.deleted = '0')
WHERE (( (CONCAT_WS(' ', node.title, ' ', field_data_field_bgcolor.field_bgcolor_value) LIKE '%green%') ))
LIMIT 10 OFFSET 0

As you can see both node.title and field_data_field_bgcolor.field_bgcolor_value are searched. And the results back that up: 1 result with "green" as Background color.