function advanced_help_search_execute

cis7 advanced_help.module advanced_help_search_execute($keys = NULL)
cle7 advanced_help.module advanced_help_search_execute($keys = NULL)
elmsmedia7 advanced_help.module advanced_help_search_execute($keys = NULL)
icor7 advanced_help.module advanced_help_search_execute($keys = NULL)
meedjum_blog7 advanced_help.module advanced_help_search_execute($keys = NULL)
mooc7 advanced_help.module advanced_help_search_execute($keys = NULL)

Implements hook_search_execute().

File

sites/all/modules/ulmus/advanced_help/advanced_help.module, line 807
Pluggable system to provide advanced help facilities for Drupal and modules.

Code

function advanced_help_search_execute($keys = NULL) {
  $topics = advanced_help_get_topics();

  $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');
  $query->join('advanced_help_index', 'ahi', 'i.sid = ahi.sid');
  $query->searchExpression($keys, 'help');

  // Only continue if the first pass query matches.
  if (!$query->executeFirstPass()) {
    return array();
  }

  $results = array();

  $find = $query->execute();
  foreach ($find as $item) {
    $sids[] = $item->sid;
  }

  $query = db_select('advanced_help_index', 'ahi');
  $result = $query->fields('ahi')->condition('sid', $sids, 'IN')->execute();

  foreach ($result as $sid) {
    // Guard against removed help topics that are still indexed.
    if (empty($topics[$sid->module][$sid->topic])) {
      continue;
    }
    $info = $topics[$sid->module][$sid->topic];
    $text = advanced_help_view_topic($sid->module, $sid->topic);
    $results[] = array(
      'link' => advanced_help_url("help/$sid->module/$sid->topic"),
      'title' => $info['title'],
      'snippet' => search_excerpt($keys, $text),
    );
  }
  return $results;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.