Read this blog on custom search in Drupal for more information.
The Drupal core provides a Search module that is great for many sites. However, it doesn’t provide some of the more sophisticated features that some sites need. The Custom Search module is a good alternative if you want more control over what gets searched, who gets to search, and what results you see.
The Custom Search module adds layers of control and sophistication to the core search module. It’s easy to install and will give you more control over the search functions on your site. It also integrates with other search modules and APIs.
The basic elements of the core search module are:
- A block for front-end display. There is very little configuration available for this block. I’ve named this one “Core Search Block” to make it easy to distinguish from the customized one We’ll be creating.
- Advanced search is available on the search results page. If a user clicks Advanced Search on the results page, a form opens up so you can refine your search.
This gives you a sophisticated search, but little control over how it’s implemented throughout the site.
How to Create Custom Search Form Drupal 8
Here we will visit the steps required to add the ExpertRec Custom search engine to your website. This is one of the easiest setup processes of all the available options out there and is highly recommended.
- Navigate to https://cse.expertrec.com/newuser?platform=cse and signup with your Google ID.
- Enter your website’s URL when prompted. You can select a server location near you and add the URL of your sitemap if you wish to. These will be auto-detected otherwise.
- You can play around with the settings and customize the UI as the crawl runs. Once it is complete, you can check out a fully functional demo before taking the search to your website.
- You can take the search to your website with little to no effort. All you need to do is to paste the code snippet available on the dashboard on your website.
ExpertRec comes with more customization options that you can explore. You can read this article to find a more detailed guide on the installation and configuration.