You are here

function activesearch_results_items in Javascript Tools 5

2 calls to activesearch_results_items()
activesearch_results_node in activesearch/activesearch.module
activesearch_results_term in activesearch/activesearch.module

File

activesearch/activesearch.module, line 187

Code

function activesearch_results_items($result, $keys) {
  $find = array();
  while ($item = db_fetch_object($result)) {
    $find[] = $item;
  }

  // Load results
  $results = array();

  // From node_search().
  foreach ($find as $item) {

    // Build the node body.
    $node = node_load($item->sid);
    $node = node_build_content($node, FALSE, FALSE);
    $node->body = drupal_render($node->content);

    // Fetch comments for snippet
    $node->body .= module_invoke('comment', 'nodeapi', $node, 'update index');

    // Fetch terms for snippet
    $node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
    $extra = node_invoke_nodeapi($node, 'search result');
    $results[] = array(
      'link' => url('node/' . $item->sid, NULL, NULL, TRUE),
      'type' => node_get_types('name', $node),
      'title' => $node->title,
      'user' => theme('username', $node),
      'date' => $node->changed,
      'node' => $node,
      'extra' => $extra,
      'snippet' => search_excerpt($keys, $node->body),
    );
  }
  foreach ($results as $entry) {
    $output .= theme('search_item', $entry, 'node');
  }
  return $output;
}