Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.1.2.6.2.92
diff -u -F^function -r1.1.2.6.2.92 apachesolr_search.module
--- apachesolr_search.module	14 May 2009 23:10:19 -0000	1.1.2.6.2.92
+++ apachesolr_search.module	19 May 2009 21:38:31 -0000
@@ -52,6 +52,17 @@ function apachesolr_search_menu() {
   return $items;
 }
 
+ /**
+ * Implementation of hook_menu_alter().
+ */
+function apachesolr_search_menu_alter(&$menu) {
+  if (isset($menu['search/apachesolr_search/%menu_tail'])) {
+    $menu['search/apachesolr_search/%menu_tail']['page callback'] = 'apachesolr_search_view';
+    $menu['search/apachesolr_search'] = $menu['search/apachesolr_search/%menu_tail'];
+    unset($menu['search/apachesolr_search/%menu_tail']);
+  }
+}
+
 /**
  * Implementation of hook_update_index().
  */
@@ -103,6 +114,32 @@ function apachesolr_search_search($op = 
 }
 
 /**
+ * Re-implementation of search_view().
+ */
+function apachesolr_search_view($type) {
+  $keys = trim(search_get_keys());
+  $filters = isset($_GET['filters']) ? trim($_GET['filters']) : '';
+  // Only perform search if there is non-whitespace search term or filters:
+  $results = '';
+  if ($keys || $filters) {
+    // Log the search keys:
+    watchdog('search', '%keys filters=%filters (@type).', array('%keys' => $keys, '%filters' => $filters, '@type' => t('Search')), WATCHDOG_NOTICE, l(t('results'), 'search/'. $type .'/'. $keys));
+  
+    // Collect the search results:
+    $results = search_data($keys, $type);
+  
+    if ($results) {
+      $results = theme('box', t('Search results'), $results);
+    }
+    else {
+      $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
+    }
+  }
+  // Construct the search form.
+  return drupal_get_form('search_form', NULL, $keys, $type) . $results;
+}
+
+/**
  * Execute a search results based on keyword, filter, and sort strings.
  *
  * @throws Exception
@@ -125,6 +162,10 @@ function apachesolr_search_execute($keys
   // This is the object that does the communication with the solr server.
   $solr = apachesolr_get_solr();
   $params += apachesolr_search_basic_params($query);
+  if (!$keys) {
+    // Add the body field in order to build a snippet from it when processing the response.
+    $params['fl'] .= ',body';
+  }
   apachesolr_search_add_facet_params($params, $query);
   apachesolr_search_add_boost_params($params, $query, $solr);
 
@@ -295,7 +336,10 @@ function apachesolr_process_response($re
     foreach ($response->response->docs as $doc) {
       $extra = array();
       $snippet = isset($response->highlighting->{$doc->id}->$hl_fl) ? theme('apachesolr_search_snippets', $doc, $response->highlighting->{$doc->id}->$hl_fl) : '';
-      if (!isset($doc->body)) {
+      if (!$snippet && isset($doc->body)) {
+        $snippet = search_excerpt('', $doc->body);
+      }
+      elseif (!isset($doc->body)) {
         $doc->body = $snippet;
       }
       $doc->created = strtotime($doc->created);
