You are here

function ds_search_apachesolr_update_index in Display Suite 7

Implements hook_apachesolr_update_index().

File

modules/ds_search/ds_search.module, line 547
Display Suite search.

Code

function ds_search_apachesolr_update_index(&$document, $node) {

  // Apache Solr multisite support. Render the node already here.
  if (variable_get('ds_search_apachesolr_multisite')) {
    ob_start();
    $element = node_view($node, variable_get('ds_search_view_mode', 'search_result'));
    print drupal_render($element);
    $output = ob_get_contents();
    ob_end_clean();
    $document
      ->addField('tm_ds_search_result', $output);
  }

  // Creme de la creme: Put the full node object in the index,
  // so no node_loads are needed for results in the Apache Solr engine.
  $document
    ->addField('tm_node', urlencode(serialize(node_load($node->nid))));
}