If you are serious about Drupal search, then you are probably aware of the fantastic integration between Drupal and Apache Solr - the open source search server based on the Apache Lucene search library. The Apache Solr Integration module offers some very straightforward instructions on replacing the core Drupal search with Apache Solr (the same search server that powers drupal.org and www.whitehouse.gov). And in replacing core search, the Apache Solr Integration module devlivers pretty much exactly what you would want and expect, such as:

  1. Faceted search
  2. Replacing taxonomy pages with Solr search
  3. Result biasing
  4. Content biasing and exclusion
  5. The list goes on and on...

But what happens when your requirements are a bit more complicated than just replacing core search?

What if your requirements call for a custom search page for a specific content type or perhaps a content type and a taxonomy term? As an example, let's say you are creating a Drupal jobs site and would like to give prospective employers the ability to search against prospective employees and for prospective employees a search page dedicated to searching jobs. In addition to that, you need a completely customized layout that is very different from the layout of your core search. You may be saying to yourself at this point: why not just use Views? And don't get me wrong, Views is an incredible module and its usefulness cannot be overstated. But what if you wanted to enable filtering. No problem you say, just used Views' exposed filters. But wait, you are already using the enterprise level, highly scalable, robust Apache Solr search for your core searches - wouldn't it make more sense to tap into that power for your custom search pages?

But how...

Looking forward to the future of search in Drupal and the release of Drupal 7, there are some exciting things in the works for highly configurable customization of Apache Solr Drupal integration. These include:

  1. The Apache Solr Views module, but it is still only available as a dev release and requires a dev version of Views.
  2. The new, Drupal 7 only, Search API - also looks promising, and allows you to utilize Views to build your custom search displays.

Many drupal site developers require a solution for Drupal 6 and one that is stable. However, all of those approaches either require Drupal 7, only have a dev release or depend on dev release code. So, the next viable option that may come to mind is to write some custom code. The Apache Solr Integration module does have some excellent hooks that allow for a large degree of search customization with custom code. There is even some documentation available on one way to go about an Apache Solr custom search by type that involves duplicating and renaming the apachesolr_search.module. But what happens when you want more than one customized search page - as in the example above? Are you going to write more custom code, or make another copy of the apachesolr_search.module? There is another solution that is based on an awesome module by the same person who is responsible for Views that, when combined with Apache Solr, allows for some code-free Drupal Solr search customization awesomeness - Panels.

Apache Solr Panels

Created as kind of a stop-gap measure until Apache Solr Views was more stable, Apache Solr Panels allows you to create any number of Panel Pages with whatever custom Solr filtering you like - by node type, taxonomy term, CCK field value - if Solr can index it, then you can filter by it with Apache Sorl Panels. Match this with a custom Panels layout, and you have the ability to create some easily configurable customized search pages for your Drupal site. Other benefits of using Solr Panel pages include:

  1. Inherent stability of the Panels and Apache Solr Integration modules
  2. Panels based UI configuration
  3. As Panel Pages, they are exportable - either via Panels or as Features

Apache Solr Panels will allow you to create the search page for employees and the search page for jobs; all with UI based configuration.

In my next Drupal Solr Panels post, I will walk you through the process of setting up and configuring an Apache Solr Panel Page, and share some tips that I have learned working with Drupal, Solr and Panels.