Index: apachesolr.index.inc
===================================================================
--- apachesolr.index.inc (revision 29114)
+++ apachesolr.index.inc (working copy)
@@ -58,19 +58,30 @@
}
if ($build_document) {
+ $node->title = apachesolr_clean_text($node->title);
+ $node_result = drupal_clone($node);
+
// Build the node body.
$node->build_mode = NODE_BUILD_SEARCH_INDEX;
$node = node_build_content($node, FALSE, FALSE);
$node->body = drupal_render($node->content);
- $node->title = apachesolr_clean_text($node->title);
+
+ $node_result->build_mode = NODE_BUILD_SEARCH_RESULT;
+ $node_result = node_build_content($node_result, FALSE, FALSE);
+ $node_result->body = drupal_render($node_result->content);
$text = $node->body;
+ $text_result = $node_result->body;
// Fetch extra data normally not visible, including comments.
$extra = node_invoke_nodeapi($node, 'update index');
$text .= "\n\n" . implode(' ', $extra);
$text = apachesolr_strip_ctl_chars($text);
+ $extra = node_invoke_nodeapi($node_result, 'update index');
+ $text_result .= "\n\n" . implode(' ', $extra);
+ $text_result = apachesolr_strip_ctl_chars($text_result);
+
$document = new Apache_Solr_Document();
$document->id = apachesolr_document_id($node->nid);
$document->site = url(NULL, array('absolute' => TRUE));
@@ -88,6 +99,7 @@
$document->language = $node->language;
}
$document->body = apachesolr_clean_text($text);
+ $document->body_result = apachesolr_clean_text($text_result);
$document->type = $node->type;
$document->type_name = apachesolr_strip_ctl_chars(node_get_types('name', $node));
$document->created = apachesolr_date_iso($node->created);
Index: apachesolr_search.module
===================================================================
--- apachesolr_search.module (revision 29114)
+++ apachesolr_search.module (working copy)
@@ -379,8 +379,8 @@
function apachesolr_process_response($response, $query, $params) {
$results = array();
- // We default to getting snippets from the body.
- $hl_fl = is_null($params['hl.fl']) ? 'body' : $params['hl.fl'];
+ // We default to getting snippets from the body stored in body_result.
+ $hl_fl = is_null($params['hl.fl']) ? 'body_result' : $params['hl.fl'];
$total = $response->response->numFound;
pager_query("SELECT %d", $params['rows'], 0, NULL, $total);
if ($total > 0) {
@@ -398,8 +398,8 @@
$snippet = '';
}
- if (!isset($doc->body)) {
- $doc->body = $snippet;
+ if (!isset($doc->body_result)) {
+ $doc->body_result = $snippet;
}
$doc->created = strtotime($doc->created);
$doc->changed = strtotime($doc->changed);
Index: schema.xml
===================================================================
--- schema.xml (revision 29114)
+++ schema.xml (working copy)
@@ -262,7 +262,8 @@
-
+
+
@@ -295,7 +296,7 @@
-
+
Index: solrconfig.xml
===================================================================
--- solrconfig.xml (revision 29114)
+++ solrconfig.xml (working copy)
@@ -474,18 +474,18 @@
true
- body
+ body_result
3
true
- body
- 256
+ body_result
+ 256
-
+
false
Index: contrib/apachesolr_attachments/apachesolr_attachments.module
===================================================================
--- contrib/apachesolr_attachments/apachesolr_attachments.module (revision 29114)
+++ contrib/apachesolr_attachments/apachesolr_attachments.module (working copy)
@@ -126,18 +126,19 @@
$document->url = file_create_url($file->filepath);
$document->hash = $hash;
$document->nid = $node->nid;
- $document->title = $file->filename;
+ $document->title = $file->filename;
$document->changed = apachesolr_date_iso($node->changed);
$document->uid = $node->uid;
$document->name = $node->name;
$document->body = $text;
+ $document->body_result = $text;
$document->text = "{$file->description} {$file->filename} $text";
$document->type = $node->type;
$document->bsfield_isfile = TRUE;
_as_configure_taxonomy($document, $node);
-
+
drupal_alter('apachesolr_attachment', $document, $node, $file);
-
+
$documents[] = $document;
}
}