Check your version

This collection covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Improve Drupal's Search with Apache Solr and Search API

When Drupal core's search module just isn't cutting it anymore, what do you do? For years, Apache Solr has been the de facto third-party search service to use with Drupal for creating robust, scalable search applications with better results, and more control over results, than core's search module. We've been using it on Drupalize.Me since the day we launched our site, and it's allowed us to make all kinds of improvements to the search tools that let our users find our content.

Over the years we've added faceted searching to allow users to narrow their results, improved relevancy or results by boosting keywords depending on the fields they are found in, and replaced the default display of search results with one powered by Views for the ultimate flexibility in design. After Solr rose (by a long shot) to the top of our suggestions, we decided to turn the knowledge we've gained from working with Solr for the last few years into a series of tutorials.

Integrate Apache Solr using Search API

In this series, we'll learn about the benefits of using Apache Solr, how to install Solr and get Drupal and Solr talking to one another, use the Search API module to index content from our Drupal site, and then look at the myriad of different ways we can display search results and influence the relevancy of keywords in order to give our users the best search experience possible.

Next, we'll look at installing Solr on your localhost for development, and also cover one of the many ways you might install Solr on a production server. In order to demonstrate installing Solr on a production server we'll fire up a virtual machine with Vagrant and install Java, Tomcat, and Solr. Then look at how we can confirm that Solr is running and ready to be used.

Then, we'll look at using the Solr configuration provided with the Search API Solr module to configure Solr in a way that allows it to better understand Drupal's field types and the data they contain. We'll also look at creating the configuration in Search API required to start indexing content, and the various settings associated with indexing. One of the big benefits of using Search API is that we're not tied to Solr as a backend. The configuration that we create for our index in Search API works with Search API Solr to create a bridge between Drupal and Solr.

Faceted search, stop words, and synonyms

Faceted searching, faceted navigation or faceted browsing are terms used to describe a technique for accessing information organized by a faceted classification system. This allows users to explore a collection of information by applying multiple filters. You'll see this often in e-commerce sites when you perform an initial search and are then given a slew of options with which to narrow the results like price, brand, availability etc. This week we'll kick things off by looking at adding some basic faceted searching to our Search API and Apache Solr integration.

Next, we'll take a look at modifying the Solr configuration's stop words and synonyms files. This allows us to exclude certain common words from our index in order to help provide better results. It also helps us deal with ambiguous words like "ipod", "i-pod", and "i pod," which are, technically speaking, different words, but all representative of the same thing. If you search for one, you would probably expect to receive results that contained any of the others.

Promote search results with Solr and Search API

Finally, we'll wrap up the Improving Drupal's Search with Apache Solr and Search API series by looking at using Solr's elevate.xml file to allow us to promote specific documents in our index when someone searches for a precise keyword or set of keywords. This enables us to create a system similar to Google's sponsored results in which we determine that when someone searches for the word "fish," there is a single document on our site that we want to guarantee always shows up at the top of the results.

Improve Drupal's search and get started with Apache Solr and Search API configuration with the help of this series of tutorials with Drupalize.Me trainer Joe Shindelar.