Filter by field that only exists for some content types shown in view We're trying to create a view with a number of exposed filters in D7. There are a number of different content types that we want to show in the same view, and to filter using the same filters. However, most but not not all of the content types have all the fields we want to filter by.

For instance, "Difficulty Level" is a field common to many of our content types, including Tutorial and Project. However, an Idea does not have this field.

Ideally, we would like to let end-users filter by a number of fields and specify whether they want the filter to be strict or flexible. Let's say the user is looking for resources that have a Difficulty Level of "Beginner" or "Intermediate":


strict would mean that only nodes that fully satisfy the filters are shown:

no Ideas would be shown, because Ideas by definition don't have a Difficulty Level field to begin with
Tutorials with a Difficulty Level of null would also not show up
an Advanced Tutorial would not be shown

flexible would mean that all nodes that don't outright disagree with the filters are shown:

all Ideas would be shown
Tutorials with a Difficulty Level of null would be shown
an Advanced Tutorial would still not be shown



Is this doable with Drupal? I've searched high and low and haven't been able to find anyone with such a problem...

EDIT: Using the and/or groups is one possible solution, however it doesn't work for taxonomy fields: these lead to joins instead of left joins, so that you can either get the items that have the requested keyword or the items that don't have any keywords, but not both at the same time.
Yes, that's doable.

I would create a separate view for strict and flexible and then tailor each to suit your needs. You may need to use hook_views_query_alter if you can't get the functionality quite right with just the view UI.

A possible simpler alternative approach is outlined in this answer here.

Essentially this involves clicking on the reduce duplicates checkbox when configuring your join in the views UI.