### Eclipse Workspace Patch 1.0 #P lyrics-vu Index: sites/all/modules/apachesolr/apachesolr.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/apachesolr/apachesolr.module,v retrieving revision 1.9 diff -u -r1.9 apachesolr.module --- sites/all/modules/apachesolr/apachesolr.module 28 Aug 2008 12:46:56 -0000 1.9 +++ sites/all/modules/apachesolr/apachesolr.module 2 Sep 2008 15:52:05 -0000 @@ -49,6 +49,18 @@ '#default_value' => variable_get('apachesolr_path', '/solr'), '#description' => t('Path that identifies the Solr request handler to be used. Leave this as /solr for now.'), ); + $form['apachesolr_onlybodyfield'] = array( + '#type' => 'checkbox', + '#title' => t('Index only body field of node'), + '#default_value' => variable_get('apachesolr_onlybodyfield', false), + '#description' => t('Index only the content of the body field and not the whole content of the page. Useful if you have a lot of views on the node page'), + ); + $form['apachesolr_excludepathalias'] = array( + '#type' => 'checkbox', + '#title' => t('Exclude the path aliases from index'), + '#default_value' => variable_get('apachesolr_excludepathalias', false), + '#description' => t('Exclude path alias from being indexed. Useful if you have hierarchical path aliases'), + ); $options = array(); foreach (array(5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100) as $option) { $options[$option] = $option; @@ -258,11 +270,14 @@ $node = node_load($row->nid); if ($node->nid) { - // Build the node body. - $node = node_build_content($node, FALSE, FALSE); - $node->body = drupal_render($node->content); + + if(!variable_get('apachesolr_onlybodyfield', false)){ + // Build the node body. + $node = node_build_content($node, FALSE, FALSE); + $node->body = drupal_render($node->content); + } - $text = check_plain($node->title) . $node->body; + $text = check_plain($node->title) .' '. $node->body; // Fetch extra data normally not visible $extra = node_invoke_nodeapi($node, 'update index'); @@ -285,16 +300,18 @@ // Path aliases can have important information about the content. // Add them to the index as well. - if (function_exists('drupal_get_path_alias')) { - // Add any path alias to the index, looking first for language specific - // aliases but using language neutral aliases otherwise. - $language = empty($node->language) ? '' : $node->language; - $path = 'node/' . $node->nid; - $output = drupal_get_path_alias($path, $language); - if ($output && $output != $path) { - $document->path = $output; - $text .= $output; - } + if(!variable_get('apachesolr_excludepathalias', false)){ + if (function_exists('drupal_get_path_alias')) { + // Add any path alias to the index, looking first for language specific + // aliases but using language neutral aliases otherwise. + $language = empty($node->language) ? '' : $node->language; + $path = 'node/' . $node->nid; + $output = drupal_get_path_alias($path, $language); + if ($output && $output != $path) { + $document->path = $output; + $text .= $output; + } + } } if ($cck_fields && strpos($key, 'field_') === 0) {