Skip to main content

Articles tagged with "solr"

Apache Solr boost Drupal search results at query-time

11th Mar 2011

Boosting terms in Solr search results produced by the Apache Solr Search module that integrates Solr with Drupal is something we had to do for a project recently. If a user has come to our website from a search engine, we can pick up the terms that they had originally searched for - and then boost any documents containing those terms in our own search pages, regardless of what they search for on our pages. (So for example, a user searches Google for 'Ski Holidays', comes to our site, and anything ski-related items should be more prominent than they would...

Read more

Quick tips: Inspecting a Solr Document

22nd Feb 2011

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.
dpm($document);

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...

Read more