Specbee: How to configure Faceted Search in Drupal - An easy step-by-step guide

Faceted search offers users with a superior search experience by displaying filters against their search results. It is particularly useful for websites having large catalogues and listings. Once the user types in their search query, they will be presented with a list of relevant filter options to further narrow down their search. These filtering elements are facets.Previously Facet API in Drupal 9, the Facet module in Drupal 10 enables your website with faceted searching abilities. Let’s look at configuring and implementing Faceted search with Drupal’s own search server, Search API. What is Faceted Search? If your users are finding it hard to see what they are searching for even after keying in their search query, they are bound to get frustrated. Faceted search provides users with multiple filters at the same time for the various attributes of the content. The facets provided are based on the search query the user has executed. Facets will also display the number of matched results (usually within brackets) next to it. Let’s take a look at this below screenshot to understand Facets better. In one of our recent Drupal projects, a quick search for Homes in Columbia on this website presents to you with facets like Communities, Hot Deals, Quick Move-ins and more. You will also see the count of the results next to each facet. So, a query with “Columbia” keyword is sent to the search server to retrieve the already configured and indexed categories (Communities, Hot Deals, etc.) Installing the Facets Module for Drupal 10 As previously discussed, we will be implementing Faceted search using Drupal’s Search API module.  Step 1: Enabling the modules Install and enable these modules •    The Facet Module •    Search API module Step 2: Creating Content Types Create the content you would like to include in the faceted search by adding Content types as shown below. You can also use the default content types provided by Drupal. Step 3: Configuring the Search server Navigate to Configuration -> Search and metadata -> Search-API from the admin interface to configure your search server. Give a name to your search server (here - data server).  Step 4: Configuring the Search Index Next, configure the search index to improve the search performance. Navigate to Configuration -> Search and metadata -> Search-API -> Index -> data_index. Give a name to your index and then select Content as your Datasources since we will be indexing the Content entities here. You can then move on to the next section - Configuring the Datasource (here – Content). Here you can choose to select all the bundles or only select a few from the below list to index. Next, select your server that you had already created (here - data server). Select the “Index items immediately” option to begin the indexing process. Click on Save. Step 5: Adding Fields for Indexing Next, we need to add Fields to be indexed. Navigate to Configuration -> Search and metadata ->Search API -> data index and select the Fields tab. Click on the Add fields button to create fields according to your requirement. Step 6: Indexing the Content Under the same location, click on the View tab to start the process of indexing your content. In the Start Indexing Now section, click on the Index Now button. It will then show you a progress bar with the status of the number of items that have been indexed. Step 7: Creating a View Now we will be creating a view for the data that needs to be indexed and displayed to your users. Navigate to Structure -> Views -> Add View. Give a name for the View.Under View Settings dropdown list, select the index that you have created in Step 4.Create a page for your search results by clicking on the Create a page checkbox under the Page Settings tab. Give a name and a path for the same. Under Items to Display, select 0 if you want to display all the results in one page. Else, select a number of results to be displayed. Under Page Display settings, you can select the format in which you want to display your results – Table, Grid, HTML list or Unformatted list. We have selected Unformatted list here. Click on Save. Step 8: Adding Fields to the View Here we will be adding fields that we have indexed earlier to the View.Go to Views, click on Add button next to the Fields section. Select the Fields, click on Add and Configure. Under Render Settings, select the Link to Content checkbox so that the results displayed are clickable.Click Save. Step 9: Configuring the Facets Now let’s begin configuring and enabling the facets. Navigate to Configuration -> Search and meta data -> FacetsClick on the Add Facet button. Select the Facet Source – This will be your View that you created previously.Select the Field – This will display the fields you had added for indexing in Step 5.Give a name to the Facet.Click on Save. Next, you will then see more configuration options for displaying the facets (as shown in the below image). Widgets will list out a number of options like List of links, array, dropdown, etc. You can choose what suits your website the best.Select the “Transform entity ID to label” to avoid displaying the machine name of the content type.Click on Save. Step 10: Placing the Facet blocks in the chosen page regions  Next, place the Facets you created as blocks in a page region of your choice. Navigate to Structure -> Block Layout. Select the region of the page where you would like to place the block containing the Facets.Here, we are selecting Sidebar. Click on the Place Block button next to the Sidebar.In the next dialog box, search for the Facet name and click on Place Block. In the Configure Block section, mention the Search page path that you had previously created. Here -“site-search” is our page we had created. Give a display name for your Block and select the Display title checkbox if you want the block name to be displayed (here – Type).Click on Save Block. The Result And just like that, your faceted search page and functionality is ready! Notice the Facet called Type (display name) that has Basic page and Article listed as content types to filter against.(Note: Since there is no content available under ‘Basic Page’, it will not show up in the filter).   Select Type as ‘Person’   Select Type as ‘Article’ Final Thoughts Implementing faceted search provides users with an easy and fast search experience. In this tutorial, we have used Search API as the search engine. You could also use search servers like Apache Solr, Search API Solr search or Elasticsearch with Drupal 8, whatever suits your requirements. As a leading Drupal development company, Specbee’s Drupal experts can help you build exemplary search experiences. Contact us to know more.

Drupal Association blog: Extending the Life of Drupal 7 with Commercial Support

As a Drupal 7 user, you might feel the pressure of the impending end-of-life (EOL) announcement. While Drupal 7 has served us well over the years, preparing for the future is essential. However, The Drupal Association has partners who offer D7 Extended Security Support.  you can confidently extend the life of your Drupal 7 site while strategically planning your migration to newer versions of Drupal. Find a partner here.

The Importance of Planning Your Migration

Migrating from Drupal 7 is crucial for staying current with new features, security updates, and performance improvements. There are significant advantages to moving to newer versions of Drupal:

  • Enhanced Security: Newer versions of Drupal come with advanced security measures that protect your site from emerging threats.

  • Modern Features: Newer Drupal versions introduce features that streamline content management, enhance user experience, and improve site performance.

  • Better Performance: Newer versions are optimized for speed and efficiency, providing a better experience for your users.

  • Community Support: With most of the Drupal community moving forward, staying on an outdated version might limit your access to community resources and modules.

To find a Drupal 7 Migration Partner to lead your migration, reach out to our Certified Migrations Partners that offer services in these categories.

The Drop Times: “It’s Time to Give Back Beyond Code”: Kevin Quillen

As part of The DropTimes' "Meet the Candidate" campaign for the ongoing Drupal Association Board Elections, Kevin Quillen, Practice Lead at Velir, shares his vision for making Drupal more accessible and appealing worldwide. With over 16 years of experience in the community, Kevin discusses his plans to modernize Drupal.org, attract new developers, and enhance the platform's global impact. Voting runs until 5 September.

mandclu: What’s Cooking with the Events Recipe for Drupal CMS

What’s Cooking with the Events Recipe for Drupal CMS Image removed.

When I first heard the vision for Starshot (now Drupal CMS), I knew exactly how I wanted to contribute. For years I have been working on trying to make it easier to quickly build Drupal sites following established best practices. I had been working on a set of modules I called Configuration Kits, but they were conceptually very similar to Recipes, albeit in a simpler (and less flexible) form.

mandclu Aug 19, 2024 - 8:48am

Tags

The Drop Times: A Name of Purpose and Clarity

<p>Dear Readers,<br><br><a href="https://www.thedroptimes.com/42282/drupal-starshot-initiative-now-officially-drupal-cms">The official naming of "Drupal CMS" marks a significant step in the evolution of the product initially developed under the Drupal Starshot Initiative</a>. The name was chosen for its clarity and simplicity, with "CMS" explicitly conveying the product's core function as a content management system. This approach addresses a common issue where users, particularly those unfamiliar with Drupal, often need clarification on what Drupal represents. Incorporating "CMS" into the name immediately defines the product’s purpose, aligning it more closely with industry norms and expectations.</p><p>The selection of "Drupal CMS" also reflects a broader strategy to make Drupal more accessible and understandable to various user groups. Participants in the testing process, especially marketers and designers, appreciated the inclusion of "CMS" in the name. For marketers unfamiliar with Drupal, the new name offered immediate recognition of the product's capabilities. Designers and other industry professionals echoed this sentiment, noting that "CMS" is a widely recognized term that accurately describes the product's function.</p><p>In contrast to Drupal CMS, Drupal Core continues to serve as the foundational framework for Drupal, offering a minimalist approach that is highly customizable but requires more technical expertise to implement fully. While Drupal Core provides the essential building blocks for creating custom web applications, Drupal CMS is designed to be more user-friendly and ready to use out-of-the-box. This distinction is crucial for users choosing between the two, as Drupal CMS comes with pre-configured modules, themes, and settings that streamline the development process, making it an ideal choice for less technical users or those needing rapid deployment.</p><p>The reception of the new name has been positive, particularly because it brings a level of clarity and accessibility that was previously lacking. By deciding to retire the internal code name "Drupal Starshot" after the first official release of Drupal CMS, the community is signaling a shift toward a more transparent and user-centered approach. This renaming simplifies the branding and helps position Drupal more effectively in a competitive market, ensuring that users immediately understand what the product offers and how it can meet their needs.</p><p>With that, let's move on to the important stories from the past week.</p><p><a href="https://www.thedroptimes.com/42278/drupal-association-board-election-2024-voting-now-open">Voting for the 2024 Drupal Association At-Large Board Member election has officially begun</a> as of August 15, 00:00 UTC. Eligible members of the Drupal community can cast their votes until the polls close on September 5 at 23:59 UTC. In relation to the election and thoroughly acquainting the candidates to the Drupal Community, <em>The DropTimes </em>began the <em><strong>"Meet the Candidate" </strong></em>campaign. This initiative features a series of interviews with each candidate, delving into their motives, expertise, and reasons for running in this election.&nbsp;</p><p>So far, The DropTimes has featured three candidates vying for the Drupal Association Board position. <a href="https://www.thedroptimes.com/interview/42166/elevating-drupal-beyond-cms-dominique-de-cooman">Dominique De Cooman</a> believes his advice can help the DA make better decisions on how to market Drupal to the midmarket and bring Drupal to market as a part of the DXP.&nbsp;</p><p><a href="https://www.thedroptimes.com/interview/42239/steering-drupals-potential-in-academia-janna-malikova">Janna Malikova</a>, a Senior Software Engineer at <a href="/organization/23133/tomato-elephant-studio" data-entity-type="node" data-entity-uuid="e140de54-1e29-4cf3-9d22-cc0c4909e30c" data-entity-substitution="canonical">Tomato Elephant Studio,</a> feels passionate about Drupal's potential in academia (schools, colleges, and universities). By teaching Drupal early on par with better advertised and competing technologies, the community has a chance to foster Drupal's recognition and improve awareness among graduates, teachers, and novice users. <a href="https://www.thedroptimes.com/interview/42122/bold-changes-propel-drupal-forward-will-huggins">Will Huggins</a>, the CEO and co-founder of <a href="/organization/8854/zoocha" data-entity-type="node" data-entity-uuid="286bb19b-bd4d-4979-90ba-be7617ae2bef" data-entity-substitution="canonical">Zoocha</a>, running in this election because he wants to contribute to the strategic direction of Drupal and the governance of the Drupal Association. Stay tuned for more.</p><p><a href="https://www.thedroptimes.com/42195/drupal-govcon-2024-heartbeat-dc-drupal-community">The premiere event of the DC Drupal Community, Drupal GovCon 2024</a><a href="https://www.thedroptimes.com/42195/drupal-govcon-2024-heartbeat-dc-drupal-community" target="_blank"><span style="box-sizing:border-box;margin:0;padding:0;text-align:left;">,</span></a><span style="box-sizing:border-box;margin:0;padding:0;text-align:left;">&nbsp;concluded successfully. As the official media partner of the event,&nbsp;</span><em><span style="box-sizing:border-box;margin:0;padding:0;text-align:left;">The DropTimes</span></em><span style="box-sizing:border-box;margin:0;padding:0;text-align:left;">&nbsp;had the privilege of speaking with the organizers to gather their insights and expectations for this year's conference. The event gathered more than 800 participants, who primarily discussed</span> government applications.&nbsp;</p><p><a href="https://www.thedroptimes.com/42243/key-rebuilding-drupal-communities-what-will-be-revealed-at-govcon-2024">A session of the Drupal GovCon 2024 featured prominent voices from the Drupal ecosystem</a>, including <a href="/people/26956/anoopjohn" data-entity-type="node" data-entity-uuid="740348ee-847a-4ca4-9357-46ce19ec9d71" data-entity-substitution="canonical">Anoop John</a>, <a href="/people/42242/amy-swackhamer" data-entity-type="node" data-entity-uuid="32b34c8a-79d6-44df-b303-972c74a0974f" data-entity-substitution="canonical">Amy Swackhamer</a>, <a href="/people/34722/ninaogor" data-entity-type="node" data-entity-uuid="4b378f54-29fe-4102-8e0b-5b541ecb42e8" data-entity-substitution="canonical">Nina Ogor</a>, and <a href="/people/9466/doyle" data-entity-type="node" data-entity-uuid="56419b1d-51a1-44d8-a407-495ac24b0efe" data-entity-substitution="canonical">John Doyle</a>. The panelists brought a wealth of experience in community building and revitalization, offering a roadmap for reconnecting Drupal enthusiasts and newcomers alike.</p><p><a href="https://www.thedroptimes.com/42277/pacific-northwest-drupal-summit-2024-sponsorship-opportunities-now-open">The Pacific Northwest Drupal Summit (PNWDS) 2024 invites companies and individuals to sponsor</a> the region’s leading event for Drupal professionals. <a href="/organization/10395/droptica" data-entity-type="node" data-entity-uuid="1a3dfede-eafe-421d-8c2a-841bbdaf44c3" data-entity-substitution="canonical">Droptica </a>is hosting a free webinar titled <a href="https://www.thedroptimes.com/42220/droptica-webinar-navigating-end-drupal-7-support"><em>"The Future After Drupal 7"</em></a> on August 27, 2024, at 3:00 PM CEST. This online event, organized by <a href="/people/32079/maciej-lukianski" data-entity-type="node" data-entity-uuid="5a16eb75-368b-4095-ad32-86d6e4f64e74" data-entity-substitution="canonical">Maciej Łukiański</a> and <a href="/people/32080/grzegorzbartman" data-entity-type="node" data-entity-uuid="6aa41a60-4108-4c9f-bed6-479ed05745dc" data-entity-substitution="canonical">Grzegorz Bartman</a>, will explore the options available for managing Drupal 7 websites after the official support ends. <a href="https://www.thedroptimes.com/42225/civicrm-hosts-session-drupal-7-end-life-and-civicrm-impact">CiviCRM will hold an online session on September 10, 2024</a>, at 4:00 PM BST to discuss the upcoming End of Life for Drupal 7, scheduled for January 5, 2025.<br><br>This week, <a href="/events/drupalcamps/drupalcamp-wolfsburg" data-entity-type="node" data-entity-uuid="022869b3-0085-404c-89db-0815d2a23f61" data-entity-substitution="canonical">DrupalCamping returns to Wolfsburg from August 22nd to 25th, 2024</a>, offering four days of camping, swimming, barbecuing, and Drupal discussions at the Allersee campsite. This event combines a relaxed, barcamp-style atmosphere with opportunities to learn, network, and enjoy outdoor activities with Drupal enthusiasts from across Germany and beyond. Tickets are now available.</p><p><a href="https://www.thedroptimes.com/42229/drupal-gutenberg-303-and-210-released">Drupal Gutenberg has released versions 3.0.3 and 2.10</a>, both of which are now fully compatible with Drupal 11. <a href="https://www.thedroptimes.com/42246/adci-solutions-launches-bibcite-demo-drupal-based-bibliographic-management">ADCI Solutions has newly launched BibCite demo</a>, an innovative module designed to streamline bibliographic data management for institutions using Drupal-based websites. Originally created years ago, BibCite has been a trusted tool for universities, research centers, and libraries. Now it offers a new demo version that allows users to experience its full functionality before installation.</p><p>Finally, <a href="https://www.thedroptimes.com/42222/dries-buytaert-present-40th-driesnote-at-drupalcon-barcelona-2024">Dries Buytaert, the founder of Drupal, will deliver his 40th Driesnote on September 24, 2024 during DrupalCon Barcelona</a>. The presentation will take place in the Auditorium at the CCIB, where Buytaert will provide an update on the current state of Drupal.</p><p>We acknowledge that there are more stories to share. However, due to selection constraints, we must pause further exploration for now.</p><p>To get timely updates, follow us on <a href="https://www.linkedin.com/company/the-drop-times/">LinkedIn</a>, <a href="https://twitter.com/thedroptimes">Twitter</a> and <a href="https://www.facebook.com/thedroptimes">Facebook</a>. You can also, join us on Drupal Slack at <a href="https://drupal.slack.com/archives/C04A6AZGYF6">#thedroptimes</a>.</p><p>Thank you,<br>Sincerely<br><strong>Alka Elizabeth</strong><br><strong>Sub-editor, </strong><em><strong>The DropTimes</strong></em><strong>.</strong></p>

#! code: Drupal 10: An Introduction To Batch Processing With The Batch API

The Batch API is a powerful feature in Drupal that allows complex or time consuming tasks to be split into smaller parts.

For example, let's say you wanted to run a function that would go through every page on you Drupal site and perform an action. This might be removing specific authors from pages, or removing links in text, or deleting certain taxonomy terms. You might create a small loop that just loads all pages and performs the action on those pages.

This is normally fine on sites that have a small number of pages (i.e. less than 100). But what happens when the site has 10,000 pages, or a million? Your little loop will soon hit the limits of PHP execution times or memory limits and cause the script to be terminated. How do you know how far your loop progressed through the data? What happens if you tried to restart the loop?

The Batch API in Drupal solves these problems by splitting this task into parts so that rather than run a single process to change all the pages at the same time. When the batch runs a series of smaller tasks (eg. just 50 pages at a time) are progressed until the task is complete. This means that you don't hit the memory or timeout limits of PHP and the task finishes successfully and in a predictable way. Rather than run the operation in a single page request the Batch API allows the operation to be run through lots of little page request, each of which nibbles away at the task until it is complete.

This technique can be used any a variety of different situations. Many contributed modules in Drupal make use of this feature to prevent processes taking too long.

Read more