Webinar: How to Build Custom Search Pages in Drupal 8

The definition of “what a search page is” varies from project to project. Some clients are happy with the core Search module, others want a full blown search engine.

Drupal offers a wide range of options when it comes to building custom search pages. You can create a basic search page using the core Search module or if you’re looking for something advanced you could use Search API.

Presentation: Search in Drupal 8

At this month’s Sydney Drupal meet up I did a presentation about Search in Drupal 8. In the video, I explain three ways you can create a search page, they are as follows.

1. Core Search

The core Search module which comes with Drupal has some new functionality in Drupal 8. The biggest change is the ability to create custom search pages without using any other module.

2. Views Filter

A common way to build search pages in Drupal 7 was to create a views page and use the “Search Keywords” filter in views. This can still be done in Drupal 8 and best of all Views is now part of core.

3. Search API

The Search API module is used to create powerful search pages and it’s highly extensible. It is the module to learn and use for building search pages.

How to Create a Search Page in Drupal 8

Building a search page isn’t as straight forward as you’d think. At first a client will want something which users can search content, then they may want to modify the search results or even change the ranking of certain content. Long story short, something you thought would be as simple as enabling a module, ends up taking twice as long.

If you need to create custom search pages in Drupal 7, more often than not, you use Search API or create a search page using Views. But the core Search module for Drupal 8 has become more powerful than in Drupal 7. One of the big changes, for site builders, in Drupal 8 is the ability to create custom search pages.

However, there’re a few limitations to creating a search page. First, it’ll have a prefix of “search/” in front but the full URL can be changed by creating a URL alias. Second, you can only adjust the content ranking on these pages. If you want to index extra fields or remove ones from being indexed, you’ll still need Search API to do this.

In this tutorial, you’ll learn how to create a custom search page and how to modify the search results by overriding a template.

Add Keyword Highlighting using Search API in Drupal 7

Search API has been my go-to module for building search pages for the last two years. Even if the client doesn’t ask for anything fancy, I still download and install Search API, use Database Search for the index and Views for the page.

If you start with Search API from the beginning, then it’s easier to customise later on. The core Search module, on the other hand, is easy to setup but hard to modify.

Recently, I had to create a search page that highlighted the keywords in the results. If you search using a particular keyword, then the word is highlighted.

How to Track Site Search Queries in Drupal

Being able to track search queries in Drupal can give you valuable insight into what your users want or need.

Let’s say for example your website only sells red bicycles, but you notice that users are always searching for yellow bicycles. This type of insight into what your users are searching for can be very useful.

In Drupal there are a few modules that can help you track keywords used on a search page. In this article, you’ll learn about a few of these modules and how to track searches using just Google Analytics

How To Setup A Local Solr Server For Search API

Running Search API and Apache Solr just got easier thanks to the latest release of the Search API Solr search module. This module allows you to use Solr as a server backend for Search API indexes. In the latest release (7.x-1.0-rc4) the module no longer has a dependency on the SolrPhpClient library.

In this tutorial I’ll show you how to setup a local development Solr server on Mac OS X 10.8.3.

Please note that this tutorial should only be used to setup a development server where you’re not worried about locking down Solr. If you want to setup Solr for a production site, then make sure you lock down the server so users can not get access to Solr.

Using Search API Ranges Module In Drupal 7

The Search API ranges module allows you to easily create a search API page with a range facet. For example, you could create a search page where users can filter products based on price, by simply selecting a price range from a facet.

The Commerce Kickstart distribution uses this module for price filtering on their product search page. If you want to see the facet in action go to the Commerce Kickstart demo site and you should see the Price facet in the left sidebar.

How To Create Search Pages Using Views In Drupal 7

A while ago I wrote two tutorials on using the Search API module. In the first tutorial, we created a custom search page using just Views and a Search API index. In the second, we looked at faceted search using the Facet API module.

Search API can be tough to setup especially for new users to Drupal. For example, you need to understand the difference between a Search API Server and Index, and then you need to spend time configuring everything.

In this tutorial, I’ll show you how to create a search page using just Views and Drupal’s core Search module.

Intro To Search API (Part 2) – Faceted Search

In part one of this series, we used Search API and Views to create a custom search page. The page is fairly basic, however it gives you a great introduction into how Search API works.

In this tutorial, we’ll add faceted search to our custom search page using the Facet API. Luckily for us, Search API and Facet API work brilliantly together so setting up faceted search is pretty easy.

Intro To Search API (Part 1) – How To Create Search Pages

The core Search module in Drupal 7 is great for simple search pages however, the configuration options are fairly limited. If you want to change the look and feel of the search results, you could use the Display Suite Search sub-module that ships with Display Suite.

You can go one step further and create a custom search page using just Views. All you need to do is create a page display and expose the Search: Search Terms filter, and you’re done. But the filter still relies on the index data that the Search module creates.

Scroll to Top