Analyze Your Solr Index on Pantheon

Ever curious about what exactly is getting indexed in Solr? Drupal abstracts Solr to a point where it can be difficult to understand how Solr is queried directly. It's actually not that difficult.

This article walks through building a Solr query by defining field lists and filter queries, analyzing results with each step. It also addresses where you can apply these filters for custom search pages in the standard Apache Solr module's configurations.

This info can be applied to any Drupal/Solr setup, but I'll focus on a Pantheon environment, as is the platform of choice for the current project I'm working on with Hook 42.

Out of the box, Solr provides an admin UI to query, but direct access isn't available from Pantheon. They do however provide a query UI with the Pantheon Solr module that works just fine.

Note: You can view a list of indexes at the following path: admin/reports/apachesolr/solr

"bundle" and "label" are fields that will be available to all nodes, but "sm_field_locations" is a field specific to my install. To follow this example, a look at the index list and select a custom field you're interested in seeing.

The query now looks like this:

/select?q=vacation&wt=json&fl=bundle,label,sm_field_locations

The results now display the fields requested, if they exist. You will notice the locatino fields don't have field_location, but my travel bundle does.

I'm hoping this takes some of the mystery out of what's going on behind the scenes with Solr. Digging into the data isn't as familiar as firing up your favorite DB manager, but it isn't so bad with the right tools and direction.