Skip to main content


How to Configure Facet Search in Drupal 9

Custom Search Facet

What is Facet Search?

  • Facet search is a way to filter content dynamically. It comes with multiple filters at the same time for the various attributes of the content. Facets will also display the number of matched results next to them. It works with the Drupal core and search API. Facet 3.0.x works with drupal 9 or 10.

Module Requirement

Step 1

Create a content type that you would like, or you can use an existing one.

Navigate to Structure >> Content type >> Add content type

Content Types

Step 2

Configure the Search Server
Navigate to Configuration >> Search and Metadata >> Search API >> Add server.

Server name, Solr host, and Solr core are all important fields you need to add.

config solr server

config solr server

Search Server Local

Finally, save it.

Step 3

Next, configure the search index.
Navigate to Configuration >> Search and Metadata >> Search API >> Add index.

Add Search Index

Configure the content datasource. Select bundles you can choose all also.

Add Search Index2

Select server and finally, save it.

Add Local Search Index

Step 4

Add Fields for Indexing
Navigate to Configuration >> Search and metadata >>Search API >> Add index and select the Fields tab. Add fields as needed and save your changes.
manage Fields For Search Index

Click on view to index the content within the same. To begin indexing, click the “index now” button.

Local Index Data

Step 5

Create a views in Drupal 9

Navigate to Structure >> Views >> Add View.

Add View faq

Add the view’s name or a description. In the view setting, choose Created Index in Step 3.
Make a page with your suggestions for the page title and path. Set up all settings and click on “Save and Edit.”
Insert Fields into the view. Inside the render setting and select the Link to Content checkbox.


Step 6

Configure the facets.
Go to Configuration >> Search and meta data >> Facets
Click on the “add facet” button. Select Facet source – This is your views.
Select fields – This is what you had created for indexing in step 4.
Name it and save it.

Facet Settings

Next, you will see more configuration options. Change the settings to meet your needs.

Edit Categories Facet

Edit Categories Facet2

Edit Categories Facet3

Edit Categories Facet4

Edit Categories Facet5

Finally, save it.

Step 7

Next, place the facets in block layout in a page region of your choice.

Go to Structure >> Block Layout.

Place the block and save it.


Hurray! Your facet search page and functionality are now ready. As you can see, some categories, such as A, B, and so on, are facets search. We used the checkbox widget in Step 6.



Our facets search has been successfully implemented. We learned about faceted search, the search API module, content type, views, and facets functionality. Happy Learning!!!


Thoughts on “How to Configure Facet Search in Drupal 9”

  1. Is it possible to display the facets with zero results. With minimum count it works. But it all pick all relevant data of other index data, for me it display the terms of other taxonomy even though the facet is not related to that taxonomy.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Sanket Tale

Sanket Tale is a Technical Consultant at Perficient. He has experience in PHP and Drupal and is Aquia Site Studio certified. Sanket is passionate about innovative technologies and is always seeking to learn more.

More from this Author

Follow Us