? 835674-search-dependency-6.patch
? 901720-7.1.patch
Index: apachesolr_search.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr_search.module,v
retrieving revision 1.53
diff -u -p -r1.53 apachesolr_search.module
--- apachesolr_search.module	4 Feb 2011 01:44:44 -0000	1.53
+++ apachesolr_search.module	14 Feb 2011 00:56:42 -0000
@@ -565,23 +565,32 @@ function apachesolr_search_add_boost_par
 function apachesolr_search_process_response($response, DrupalSolrQueryInterface $query) {
   $results = array();
   // We default to getting snippets from the body.
-  $hl_fl = isset($query->params['hl.fl']) ? $query->params['hl.fl'] : 'body';
+  $hl_fl = isset($query->params['hl.fl']) ? explode(',', $query->params['hl.fl']) : array('body');
   $total = $response->response->numFound;
   pager_default_initialize($total, $query->params['rows']);
   if ($total > 0) {
     foreach ($response->response->docs as $doc) {
       $extra = array();
 
+      // Start with an empty snippets array.
+      $snippets = array();
+
       // Find the nicest available snippet.
-      if (isset($response->highlighting->{$doc->id}->$hl_fl)) {
-        $snippet = theme('apachesolr_search_snippets__'. $doc->entity . '__' . $doc->bundle, array('doc' => $doc, 'snippets' => $response->highlighting->{$doc->id}->$hl_fl));
-      }
-      elseif (isset($doc->teaser)) {
-        $snippet = theme('apachesolr_search_snippets__'. $doc->entity . '__' . $doc->bundle, array('doc' => $doc, 'snippets' => array(truncate_utf8($doc->teaser, 256, TRUE))));
+      foreach ($hl_fl as $hl_param) {
+        if (isset($response->highlighting->{$doc->id}->$hl_param)) {
+          // Merge arrays preserving keys.
+          foreach ($response->highlighting->{$doc->id}->$hl_param as $values) {
+            $snippets[$hl_param] = $values;
+          }
+        }
       }
-      else {
-        $snippet = '';
+      // If there's no snippet at this point, add the teaser.
+      if (!$snippets) {
+        if (isset($doc->teaser)) {
+          $snippets[] = truncate_utf8($doc->teaser, 256, TRUE);
+        }
       }
+      $snippet = theme('apachesolr_search_snippets__'. $doc->entity . '__' . $doc->bundle, array('doc' => $doc, 'snippets' => $snippets));
 
       if (!isset($doc->body)) {
         $doc->body = $snippet;
@@ -612,6 +621,7 @@ function apachesolr_search_process_respo
         // These values are not required by the search module but are provided
         // to give entity callbacks and themers more flexibility.
         'score' => $doc->score,
+        'snippets' => $snippets,
         'snippet' => $snippet,
         'fields' => $fields,
         'entity_type' => $doc->entity,
@@ -1252,7 +1262,7 @@ function apachesolr_search_theme() {
       'variables' => array('total_found' => NULL, 'links' => NULL),
     ),
     'apachesolr_search_snippets' => array(
-      'variables' => array('doc' => NULL, 'snippets' => NULL),
+      'variables' => array('doc' => NULL, 'snippets' => array()),
     ),
     'apachesolr_search_noresults' => array(
       'variables' => array(),
@@ -1388,8 +1398,19 @@ function theme_apachesolr_currentsearch(
  */
 function theme_apachesolr_search_snippets($vars) {
   $result = '';
-  if(is_array($vars['snippets'])){
-    $result = implode(' ... ', $vars['snippets']);
+  if (is_array($vars['snippets'])) {
+    $snippets = $vars['snippets'];
+    if (isset($snippets['body'])) {
+      $result .= $snippets['body'];
+      unset($snippets['body']);
+    }
+    if (isset($snippets['teaser'])) {
+      $result .= (strlen($result) > 0) ? ' ... ' : '';
+      $result .= $snippets['teaser'];
+      unset($snippets['teaser']);
+    }
+    $result .= (strlen($result) > 0) ? ' ... ' : '';
+    $result .= implode(' ... ', $snippets);
   }
   return $result . ' ...';
 }
? SolrPhpClient/.svn
? SolrPhpClient/COPYING
? SolrPhpClient/Apache/.svn
? SolrPhpClient/Apache/Solr/.svn
? SolrPhpClient/Apache/Solr/Document.php
? SolrPhpClient/Apache/Solr/Response.php
? SolrPhpClient/Apache/Solr/Service.php
? SolrPhpClient/Apache/Solr/Service/.svn
? SolrPhpClient/Apache/Solr/Service/Balancer.php
