Combined fields filter

Submitted by nmeegama on Thu, 09/24/2015 - 11:51

What?

A combined fields filter is a filter added to views so that the users keyword will be search against multiple fields of the node

How ?

We can add and configure the filter as shown in the following images

Adding the filter

  1. Add filter Criteria
  2. Search to filter the combined filter
  3. Select the filter by checking the box
  4. Apply the filter

Configure the filter

  1. Click on the filter to Configure the filter
  2. Expose it (optional)
  3. Select the operator
  4. Choose the filter you would like to combine and search for
  5. Apply

 

Problem Areas

Combined filters do not work properly with entity references

Scenario

For example say the you have a website selling mobile phones and the Manufacturer field is a entity reference like Sony, Motorola, Nokia.... If you add this filed to the view filed lis and select it as a combined field it wont search properly. Here is a screen shot of what not to do

Selecting the filed to combine wont work

 

Solution

Step 1 : Add and configure the relationship

Add a relationship to the referenced entity

  1. Click the Add relationship link
  2. Search to filter the relationships
  3. Select the relationship to the referenced entity
  4. Apply

Configure the relationship

  1. Click on the relation ship
  2. Apply
Step 2 : Add a field with the relationship created

Add the title filed of the referenced node/entity

  1. Click add field select Content : Title and apply
  2. On the settings window for the field Select the relationship (Addded on the previous step)
  3. Exclude it from the display (optional)
  4. Apply
Step3: Combine the filed on the Combined filed filter

Combine the new filed

  1. Click on the Combined filed filter to combine the new field
  2. Select the new field
  3. Apply

Now the user should be able to search on the entity reference field also.