Sanket Tale, Author at Perficient Blogs https://blogs.perficient.com/author/stale/ Expert Digital Insights Wed, 19 Jun 2024 19:18:16 +0000 en-US hourly 1 https://blogs.perficient.com/files/favicon-194x194-1-150x150.png Sanket Tale, Author at Perficient Blogs https://blogs.perficient.com/author/stale/ 32 32 30508587 How to Configure Facet Search in Drupal 9 https://blogs.perficient.com/2023/01/19/how-to-configure-facet-search-in-drupal-9/ https://blogs.perficient.com/2023/01/19/how-to-configure-facet-search-in-drupal-9/#comments Thu, 19 Jan 2023 09:04:30 +0000 https://blogs.perficient.com/?p=325874

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.

Ref. https://www.drupal.org/docs/8/core/modules/views

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.

Result

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.

Output

Conclusion

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

 

]]>
https://blogs.perficient.com/2023/01/19/how-to-configure-facet-search-in-drupal-9/feed/ 3 325874