The Combine fields filter in Drupal Views

How to search content across multiple content types and multiple fields.

On a recent Drupal site, a key requirement was to provide the ability for end users to be able to filter a set of results based on free text keywords. To many, this may seem like a complicated requirement which could involve days or weeks of custom development. With Drupal Views, the correct data model, and the Global: Combine fields filter, this is all achievable with just some configuration and no development whatsoever.

Firstly, like with any Drupal project, you need to ensure you have planned out your data model. You need to decide which fields you want to be searchable as these will need to be defined in your Drupal View later.

IMPORTANT: you can’t use the main Body field of a Content Type, as this is a special field (it combines Summary and Body), which the combine fields filter can’t search on. The combine fields filter can only search in Text field types without the Summary.

In this example, I have 2 fields: Title and Content. Body is being made redundant to make way for a field that can be searched: Content.

dan_fields_articles_01.jpg

Secondly, you need to ensure that your View is usings Fields formatting, and not Content formatting, as you need to add each individual field so that they can be combined using the combine fields filter.

dan_fields_articles_03.jpg

Thirdly, you need to configure the Global: Combine fields filter (as demonstrated in the screenshot below) and expose the filter. This can only be used with a Views Page, not a Views Block, as exposed filters do render using a Views Block.

dan_fields_articles_02.jpg

You now have a fully working in-page search to filter content listings. You can off course add additional content filters and sorting criteria, such as alphabetical and date created. Pretty quickly you can build up a very powerful in-page search feature, all using the power of Drupal Views.

To conclude, this solution isn’t suitable for large scale searching or if using a large number of fields, due to adding additional overhead to the database query. At this point, it would be advisable to use Drupal’s Search API module and a 3rd party search engine (e.g. Elasticsearch).

But as a Drupal configurator, it is very convenient to be able to achieve this basic search requirement using Drupal Views, rather than needing to invest in development time.

Microsoft Ads UET Tag Update

Microsoft Ads UET Tag Update

In May, Microsoft Ads launched a significant update to its Universal Event Tracking Tag (UET Tag). The UET Tag has always been a fundamental part of conversion tracking, audience building for remarketing and automated bidding strategies. The latest update from...

Let's chat. Tell us a bit about your project.

 If you prefer to speak with someone, call 01202 203160 or if you'd like to book a 30 min meeting to see if we can help just let us know and we'll arrange a call with one of our Directors.

Attraction Marketing Using Google

Attraction Marketing Using Google

Brunel’s SS Great Britain is Bristol’s number one visitor attraction and a top 10 UK museum (TripAdvisor 2022). It is home to the world’s first great ocean liner, the SS Great Britain, the Being Brunel museum, and the Brunel Institute, which houses one of the world’s finest maritime and Brunel collections. The charity that manages and maintains Brunel’s SS Great Britain and collections is the SS Great Britain Trust.

Charles Stanley Direct PPC

Charles Stanley Direct PPC

Charles Stanley set us the challenge of delivering improved performance from their PPC campaigns. In a highly regulated industry, with multiple stakeholders to govern marketing activities and an ever changing market, the brief called for exceptionally high levels of service, reporting and flexibility.

Avery WePrint – Content Strategy

Avery WePrint – Content Strategy

We were tasked to increase revenue from new and returning customers by delivering a content strategy with objectives to improve SEO for article pages and produce engaging content to link to from their emails..

Google Grant PPC Management

Google Grant PPC Management

Digital Marketing: Google Grant PPC Management IntroductionThe Centre for Ageing Better is an independent charitable foundation, funded by The National Lottery Community Fund. It creates change in policy and practice informed by evidence and works with partners across...

Legoland Discovery Centre Launch Campaign

Legoland Discovery Centre Launch Campaign

We were delighted to win the brief to help Merlin Entertainments’ launch Legoland Discovery Centre, Birmingham.

The ultimate indoor playground was the second to be built in the UK and opened just outside the centre of Birmingham.

SEO and Social Success for Holiday France Direct

SEO and Social Success for Holiday France Direct

Like many businesses, Holiday France Direct wanted to increase the number of visitors to their website from non-paid traffic and increase their social reach and engagement. They came to us with a brief to upgrade their website and to run a programme of monthly SEO and Social activity.

Blackpool Has it All

Blackpool Has it All

We love working in travel and tourism. So we were thrilled when the UK’s top beach resort asked us to plan and deliver the digital marketing for their 2018, 2019 and 2021 destination marketing campaigns.

Post Pandemic Pickup

Post Pandemic Pickup

As global travel markets opened up following the COVID-19 pandemic, we supported a valued client with a range of (very flexible) PPC and social marketing services to help their business rebound.