A Better Search Solution for Drupal Sites: Apache Solr

Drupal 6 has a standard out-of-the-box internal search system that includes the basic features, I'll highlight the most important ones:

  • Select content types to be indexed.
  • Filter search results by content type.
  • Display results based on weights: Keyword relevancy, Recently updated...

Apache Solr

This might be all you need if you have a small website with a small amount of content. But what happens if you have thousands of nodes? Even if you categorize the content, the user will be too many clicks away from what he is looking for. This is just not the way to do it,you can improve the user experience and make the content on your site really searchable and easy to reach. The solution is called Solr.

Solr is an open source search server based on the Lucene Java search library. But why are we talking about Java when Drupal is a PHP based CMS? Well over the last couple of months a new module has been developed called Apache Solr Search Integration. This module is still on beta for Drupal 6 but its not far from being stable. How does it work? Ill put it in a simple way:

  1. Solr runs on a separate web server.
  2. The module handles the indexing and search requests,sending them to the solr server.
  3. Solr returns the results given the parameters.

Solr is a great search system, featuring:

  • Content Recommendation
  • Tag clouds: Displays number of results for each tag.
  • Smart searching: "Did you mean" feature, Conjugations (i.e. searching for "moderating" displays results for "moderator" as well)
  • Result biasing based on weights for : Content type, fields, comments, taxonomy.
  • Dynamic filters based on date, author, taxonomy term, content type, or other attributes.

These are just some of the features Solr has, the module will implement more features in the future.

Now, this might sound simple and easy but setting up your own Solr server might take you some time if you dont have any experience with it. The good news is you can avoid setting up the server and worrying about scaling and reliability by getting a hosted service. If you are interested in testing Solr with Drupal, Acquia provides a free beta subscription. Acquia hosts the solr server for you, you are only required to follow their simple steps.