Advanced Drupal Searching

As anyone who's tried to use the default search in Drupal knows, it's functional, but not great.  It works for a small site that just needs very basic search functionality, but it has a lot of drawbacks:

  • Can only search title and body, nothing else.
  • Changing the output requires editing php template files.
  • Entirely database driven, so it uses a lot of resources.
  • You can't control the relevancy scoring so sorting by different parameters is impossible.

There have been a few different options in the past, but anymore the go to module for all things search is: Search API.  Search API works as a general interface between various search backends and the front end display of search.  It integrates with views and other modules to allow for easy configuration of the output.  It allows you to weight matches, searches as many fields as you want, tokenizes and processes your search data so it can support partial word searching, and by integrating with various front end modules can give you a lot of cool functionality.

That's all great, but what backends are available?  There are a bunch of them, but there are two favorites in my mind: SOLR and Cloud Search.  And if you can't afford an external server, there's a fallback for old fashioned database searching.  A brief comparison of them is:

  • Database is the most heavy hit to performance and doesn't come with a lot of functionality.
  • Cloud Search has a lot of the same functionality that SOLR has, but it easier to deploy, scales to larger data sets, and comes with a simple UI to add synonyms, etc.  It however is a sandbox module so development on it has been pretty sparse.
  • SOLR is the Drupal standard at this point, as it has the most functionality, can do geospatial searching, index documents, etc.  It's written in java so it's fairly heavy and usually needs it own server so it won't affect your site, but it has a lot of developer power behind it as well.

​What kind of functionality am I talking about?  Here's a few of the main modules that add functionality to search api: