Each day, more Drupal 7 modules are being migrated to Drupal 8 and new ones are being created for the Drupal community’s latest major release. In this series, the Acquia Developer Center is profiling some of the most prominent, useful modules, projects, and tools available for Drupal 8. This week: Search API.
I’d say that both maintainers of Search API, Thomas Seidl and Nick Veenhof (drunken monkey and nick_vh on Drupal.org) are a part of Robert Douglass’s search legacy in Drupal. Thomas was a Google Summer of Code student in 2008, 2009, 2010, and 2011--mentored the first three years by Robert. For GSoC 2010, he created the Search API module and has been working on it ever since. Nick has been passionate about Drupal since he got started with it in 2008 and developed much of the Apachesolr module for Drupal 7 as his Master’s degree thesis. He got his start at Acquia by asking Robert Douglass if he could do an internship at Acquia. He can’t remember the last time he built a website, but Nick is now the Technical Product Owner for Acquia Lift and says, “But I love it if I can be a part of the evolution of the web, one piece of the puzzle at a time.”
What does the Search API Module do?
The Search API Module--in use on more than 80 thousand Drupal 7 and 800+ Drupal 8 sites as of March 2016--is a toolset for creating searches on Drupal sites, built to support the complex data-structures you can encounter in Drupal applications. Site builders can use it to create powerful search interfaces for end users. Furthermore it presents a flexible framework for developers to create new, reusable search-related modules. It is extensible, providing connectors to other search engines and technologies like Apache Solr, for example, which you might choose to improve the speed and relevancy of your search results.
Why is this important?
Using Search API’s standardized, commodity functionality--all the usual building blocks and details of a search implementation--saves developers time and allows them to concentrate on the specific, search-related functionality they want to provide, instead of reinventing search every time. For implementing site-specific functionality, it offers a plethora of hooks and plugin types to customize the module's behavior and functionality.
“Because it provides an unseen level of customization for showing, searching and slicing content in your own site. It is able to convert your data into denormalized versions as we see in document storage systems that allow very quick searching capabilities across those documents like Apache Solr and Elastic Search. Mainly due to the way Search API was written (huge props to Thomas) developers are able to start with a simple database setup and move towards a more complex setup using Apache Solr without starting all over again. It also provides a ton of developer friendly places to customize the indexing process, the search process, and basically anything you'd want. Developers also don't want to be held back by constraints that tell them they can't do X or Y. Freedom basically!” - Nick Veenhof
Search API is backend-agnostic, so it is easy to start with a standard basic solution and upgrade later if your site’s popularity or complexity demands it. Upgrading to Apache Solr, for example, makes professional-level search easily available for Drupal sites in a flexible way. Site owners can decide when they want to switch to a more performant search backend and optimize as and when needed. This lowers the initial cost of owning a website and allows for rapid development times. Site-builders, -owners, or -admins can tweak the huge number of interesting configurable options until they get search results and mechanisms just right for their needs.
When was Search API Module created?
“Search API was created in 2010. I was involved in discussions about how to improve Drupal’s core search module and turn it into more of a framework for Drupal 8. The problem was that there was no search framework in Drupal and all search-related modules had to include the same boilerplate code over and over. I took the best parts of that discussion and turned them into a contributed module and search framework for Drupal 7.” - Thomas Seidl
Has Drupal 8 changed this module?
“Drupal 8 core includes many useful patterns, mechanisms, and paradigms that Search API could take advantage of. On the one hand, this allowed us to clean up its code base a lot, on the other hand, just the fact of having this new ‘blank slate’ in D8 inspired us to add and improve functionality, while risking breaks in compatibility and trying new things. Drupal 8’s vastly improved test framework has helped us a lot and is still helping us in ongoing development.” - Thomas Seidl
“Drupal 8 has also helped in forcing us to rethink certain concepts and also live up to our promise to avoid the divide we had in Drupal 7 between the Apache Solr Module and Search API--Search API will be the sole provider of Apache Solr integration in Drupal 8. Search API in Drupal 8 ships with sane defaults (which you can enable or disable) that pre-configures the module so it can be used instantly.” - Nick Veenhof
Even though the module is already largely very usable in Drupal 8, the port is still a ways off from being ‘finished’ as of March 2016. The maintainers estimate that they and their teams have put in more than one thousand hours into porting and adding new functionality in the last two and a half years. And it’s important to point out that the process is made more difficult by the fact that there wasn’t just one module to port, but rather a whole ecosystem of modules like search_api_solr, search_api_multilingual, facets (formerly Facet API) and more.
More on Drupal 8 Search API
Interesting and useful features include:
- Index all kinds of content and search through it within a single search page
- Index items externally (outside of Drupal) into an index like Apache Solr. Then Search API can:
- be your interface to that data, searching it and displaying it on your site.
- also provide you with federated- and cross-site-searching.
- Search facets are available and fully compatible with Drupal 8’s new rendering system. “Trust us, it was harder than it would seem,” insists Nick :-)
- Are you tired of making manual changes to the complex schema.xml file for Apache Solr when using the apachesolr_multilingual module and adding new languages? Start to use Solr 5 & and the Search API Multilingual Solr Search Module will do that for you automatically!
State of Search, Solr and Facets in Drupal 8 - A presentation by Nick Veenhof and Joris Vercammen from Drupalcamp Belgium 2015. Slides and notes on Slideshare.com.
“Our thanks goes to Acquia, MD Systems, Intracto and a few smaller donors and clients for financial support. Thanks as well to the large number of people who helped with development tasks and patches.” - Thomas Seidl
“Back at the end of 2013, we wrote a battle plan announcing we would merge Apache Solr Search and Search API for Drupal 8. Two and a half years and a lot of blood, sweat, and tears later, we’ve achieved most of the goals we listed in that blogpost without having to kill anyone … I’d call this whole thing a huge success! I want to express my deepest thanks to Thomas Seidl. A lot of this effort was driven by his passion. Without it, the project wouldn't have succeeded or even worked at all. On top of that, my thanks goes to the sponsors and all the contributors who volunteered. All of this came together to achieve what we have today. Thank you all for your help, even if it was just 1 commit or 1 review, it made a difference.” - Nick Veenhof.
“During some DrupalCon or other, we couldn't agree on a name for a request handler (because naming things is hard) and we settled on "pinkPony". I thought it was hilarious when a blog post explaining Solr query fields came out and mentioned it as though that were the most normal case in the world.” - Nick :-)
Pink Pony jpg by https://www.flickr.com/photos/cmoi/, Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0): https://creativecommons.org/licenses/by-sa/2.0/