You are here

function apachesolr_search_node_result in Apache Solr Search 8

Same name and namespace in other branches
  1. 6.3 apachesolr_search.module \apachesolr_search_node_result()
  2. 7 apachesolr_search.module \apachesolr_search_node_result()

Callback function for node search results.

Parameters

stdClass $doc: The result document from Apache Solr.

array $result: The result array for this record to which to add.

2 string references to 'apachesolr_search_node_result'
apachesolr_search_apachesolr_entity_info_alter in ./apachesolr_search.module
Implements hook_apachesolr_entity_info_alter().
hook_apachesolr_entity_info_alter in ./apachesolr.api.php
Add information to index other entities. There are some modules in http://drupal.org that can give a good example of custom entity indexing such as apachesolr_user, apachesolr_term

File

./apachesolr_search.module, line 1425
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_node_result($doc, &$result, &$extra) {
  $doc->uid = $doc->is_uid;
  $result += array(
    'type' => node_type_get_name($doc->bundle),
    'user' => theme('username', array(
      'account' => $doc,
    )),
    'date' => isset($doc->changed) ? $doc->changed : 0,
    'node' => $doc,
    'uid' => $doc->is_uid,
  );
  if (isset($doc->is_comment_count)) {
    $extra['comments'] = format_plural($doc->is_comment_count, '1 comment', '@count comments');
  }
}