Announcing Apache Solr Pages

Ever needed to produce functionality in Drupal that multiple modules came really close to providing — but none of them seemed to get it quite right? We recently experienced this issue when needing to create an advanced search page in Drupal 7 for a client. We needed the ability to create pre-filtered result pages from essentially an empty query, displaying everything in a default result that the user could then continue to filter or search within, as needed. This was a strict UI requirement we faced, so we had to rule out what otherwise might have been reasonable alternatives, such as using normal Views with exposed filters. That Solr-like experience was essential.

We knew we needed facets, and we knew that Apache Solr would fit that bill nicely. But we also needed a way to make our own pre-filtered pages as a starting point. Search API would fulfill that need, but to use Search API would require working with entities for the results — and Search API is also facing some refactoring that we wanted to avoid having to compensate greatly for.

Well, if Views alone wouldn't match the interface requirements, what about Views in Apache Solr? Sadly, Views support isn’t in Apache Solr for Drupal 7 yet. So we had to go back to the drawing board and, keeping simplicity in mind, find a way to solve our client's basic requirements.

After having the opportunity to meet with Peter Wolanin, one of the co-maintainers of Apache Solr, it became apparent that we may not even need to port, or integrate into the main Apache Solr project, Apache Solr Views to solve our issue.

Apache Solr PagesApache Solr Pages extends Apache Solr pre-filtered result pages, displaying everything in a default result, with exposed facets.

Applying the logic of creating the simplest solution to fulfill our needs in several hours of late-night development I was able to repurpose another Search API feature, the searchapi_page module, and use it in the context of Apache Solr. This gains us a few distinct advantages:

  • We are able to create the multiple pre-filtered pages we need for our use case.
  • We don’t have to rely on the overhead and complexity of using views to build our Solr query.
  • We’re indirectly able to provide an extension use case in Drupal 7 for Apache Solr module.

The Apache Solr Pages module [corrected URL] is still in need of additional work and a lot of cleanup to remove all of the legacy bits that were carried over from Search API; however, it is presently working for our basic use case. The following features actively need additional help to bring the module to a product-ready release:

  • Apache Solr’s “Current Search” block needs to receive proper integration, with the pre-defined filters being hidden or locked in with disabled fields per the administrator’s choice.
  • This also provides a chance to look into ways to better allow the Current Search block to be extensible by other modules upstream in Apache Solr.
  • View modes that were in Search API’s rendition of pages aren’t supported here; Search API code that allowed this is still in the module but needs refactoring to work.
  • Paging is currently broken due to the difference in how Search API and Solr return results.
  • Need to apply Apache Solr’s “on empty” effect, or allow it to be overridden on a page-by-page basis.

The Drupal 7 branch of Apache Solr Pages is available for download today, and I look forward to seeing more input from the community not just around this module, but around search in the future of Drupal in general.

We want to work with you!