Drupal has a default search engine that offers certain basic search features. One of the key features missing is the faceted search. Expertrec has built a drupal search engine that adds extra functionalities like autocomplete and faceted search to the default drupal search. Here is how you can create a faceted search for Drupal using expertrec.
How to create a Drupal Faceted Search ?
In this method, we will create a drupal faceted search using expertrec and add it to your Drupal site using Google tag manager drupal plugin. We will also see how to enable faceted search inside expertrec’s control panel.
- Go to drupal faceted search creator.
- Sign up with your Gmail id.
- Enter your drupal website and sitemap URL.
- Crawl of your website will start.
- Once the crawl completes. go to the code section and copy the code.
- You can as well check the demo of how your Drupal search will work.
Go to https://cse.expertrec.com/csedashboard/searchconfig/facets. Click on enable facets. Under the list of selected facets, use the + button to add or remove facets. In the below image, you can see that type, brand and brand.name are chosen as facets. The facets crawled depend on the contents crawled in your website.
Once you enable the facets, you will be able to see the facets in your search demo. An example is shown in the image below.
Adding the search engine using google tag manager
- Install the google tag manager extension for drupal.
- Once you install, go to General-> Container ID-> and add your google tag manager ID to it. Google tag manager lets you add and manage multiple code to your website and choose how to fire each of them.
- Go to drupal faceted search code and add the first part of the code (the code that begins with <script>) to your google tag manager as a custom HTML.
- Under triggers, set it to all pages where you want the search engine to be displayed.
- In your Drupal admin panel, go to Structure-> Block layout-> Header ->Place block-> Add custom block-> click on source and enter the following code. (choose text format as full HTML). This places the search box in your Drupal header. <ci-search></ci-search>