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.
Create a content type that you would like, or you can use an existing one.
Navigate to Structure >> Content type >> Add content type
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.
Finally, save it.
Next, configure the search index.
Navigate to Configuration >> Search and Metadata >> Search API >> Add index.
Configure the content datasource. Select bundles you can choose all also.
Select server and finally, save it.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
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.
Click on view to index the content within the same. To begin indexing, click the “index now” button.
Create a views in Drupal 9
Navigate to Structure >> Views >> Add View.
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.
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.
Next, you will see more configuration options. Change the settings to meet your needs.
Finally, save it.
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!!!