Want to get Lullabot article, videocast, and podcast announcements delivered right to your in-box? Let us know your email address (we won't share it) and we'll let you know when anything exciting happens.

Subscribe to our bi-weekly audio podcast - The Lullabot Drupal Podcast, our daily interview snippets - Drupal Voices, our periodic videocasts, or everything. Just choose your favorite podcast-listening application or service and click away!


Drupal Podcast 69: Solr with Robert Douglass and Jacob Singh

  • Artist: Lullabot
  • Title: Drupal Podcast 69: Solr with Robert Douglass and Jacob Singh
  • Album: Drupal Podcast
  • Year: 2009
  • Length: 46:09 minutes (11.71 MB)
  • Format: Mono 22kHz 35Kbps (VBR)

Jeff Robbins talks to Robert Douglass and Jacob Singh about Solr.

Comments on this post will automatically be closed three months from the original post date.

Comments

Shameless self-promotion:Sign up for the free Acquia Search beta

Sign up at http://acquia.com/node/229650 and put some muscle into your Drupal search!

We need more beta testers!

Have a Drupal 6 site? Want to experience the power of Solr search? Use the link above to sign up. We'll be in contact with you.

The ApacheSolr module

What happens if I want an

What happens if I want an image displayed next to the search results, like on an e-commerce site where the user is searching for a product. Can it do this?

Yes, for image module, this is already built in.

I'd like to add imagefield support too, eventually, but if you look at the image module integration you'd probably see all you need to implement this with imagefield.

Plus you can always do this outside of the solr index by overriding the theme functions that show search results. So yes, totally possible, and for image module, built in.

Themeing is probably the most flexible route

ApacheSolr "just" returns results, in a Drupal-agnostic way, and the apachesolr module scoops them up. It then exposes properties like the node ID (or at least it did in alpha5), so you can add a preprocess hook in template.php to grab the node for each result on the currently viewed page:

<?php
function phptemplate_preprocess_search_result(&$vars, $hook) {
 
$n = node_load($vars['result']['node']->__get("nid"));
 
$n && ($vars['node'] = $n);
}
?>

You can then render aspects of the node in a file called search-result.tpl.php, again in your theme directory. Expect to need to clear the cache during development, for new theme files to be recognized!

This is the route we took recently, as we had heterogeneous content in some of our searches. A bit more hard work but you can tailor the HTML to your heart's content.

True - but beware node_load

node_load is avoided in the current ApacheSolr implementation, and this is a good thing. It boosts performance dramatically. If you could grab the data straight from the db tables it might be better (but then, beware node_access). Your approach is very flexible, and very much "the Drupal way", but I just wanted to emphasize the node_load hit on performance.

Drupal Search.

This sounds really great, and it gives up another very good option to improve search.

But I have found that the current built in search for Drupal is quite good, and does hold it's own. If you take a look at http://twit.tv which uses the Google CSE search and also allows access to the standard search, I find that the standard search does very well, and in some cases it is much more targeted that Google CSE.

I am not 100% sure how the Google CSE is set up as this was doing by Leo, and the rest was done by me.

Solr better than Google CSE

Solr utilizes more Drupal metadata than any previous search implementation I know of, including core search. It also has more knobs and levers that you can adjust to run-time tweak your search results. I suspect that site administrators will be able to get the most relevant searches they've ever seen with Solr.

For those looking to improve Drupal core's search...

Robert's done a great job prioritizing and highlighting major patches that need some helping hands over at http://drupal.org/node/366930.

Costing?

Robert, or anyone from Acquia - do you have any indication as to the pricing of the Acquia hosted service?

Acquia Search beta

We're planning to run an extended beta, during which time it will be free to anyone using the Acquia Network. More details on the public beta will be available at Drupalcon DC or you can sign up for the private beta today.