fbpx Quick tips: Inspecting a Solr Document | ComputerMinds Skip to main content

Quick tips: Inspecting a Solr Document

An article from ComputerMinds - Building with Drupal in the UK since 2005.
22nd Feb 2011

Steven Jones

Senior Developer

Another quick tip here: if you're working with the Apache Solr module, specifically looking at the documents that are being created from your nodes, and you want to print out the document and have a look at what fields and values are on your $document then if you did this:

// Print the $document using the devel dpm function.

Then you would get a very unhelpful output from Krumo, because all the fields on the $document are protected, and so the devel module can't access them. Instead you can do this:

dpm(array_combine($document->getFieldNames(), $document->getFieldValues()));

And you'll get a nice array of field names mapped to their values.