Posted on January 30, 2009 // Short URL

Solr with Robert Douglass and Jacob Singh

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

Comments

Sean

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?

Reply

Robert Douglass

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.

Reply

J-P

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.

Reply

Robert Douglass

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.

Reply

Gordon Heydon

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.

Reply

Robert Douglass

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.

Reply

Charles

Costing?

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

Reply

Bryan House

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.

Reply