function node_ds_search_execute

cis7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)
cle7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)
elmsmedia7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)
icor7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)
meedjum_blog7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)
mooc7 ds_search.module node_ds_search_execute($keys = NULL, $conditions = NULL)

Search on behalf of Drupal Core.

File

sites/all/modules/ulmus/ds/modules/ds_search/ds_search.module, line 449
Display Suite search.

Code

function node_ds_search_execute($keys = NULL, $conditions = NULL) {
  // Build matching conditions
  $query = db_select('search_index', 'i', array('target' => 'slave'))->extend('SearchQuery')->extend('PagerDefault');
  $query->join('node', 'n', 'n.nid = i.sid');
  $query->condition('n.status', 1)->addTag('node_access')->searchExpression($keys, 'node');

  // Language.
  if (variable_get('ds_search_language', FALSE)) {
    global $language;
    $query->condition('n.language', $language->language);
  }

  // Insert special keywords.
  $query->setOption('type', 'n.type');
  $query->setOption('language', 'n.language');
  if ($query->setOption('term', 'ti.tid')) {
    $query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
  }
  // Only continue if the first pass query matches.
  if (!$query->executeFirstPass()) {
    return array();
  }

  // Add the ranking expressions.
  _node_rankings($query);

  $limit = variable_get('ds_search_node_limit', 10);
  $query->limit($limit);

  // Load results.
  $find = $query->execute();
  $results = array();
  foreach ($find as $item) {
    $node = node_load($item->sid);
    $node->entity_type = 'node';
    $node->entity_id = $item->sid;
    $node->search_extra = module_invoke_all('node_search_result', $node);
    // Only build a node search snippet if this field is actually being used.
    $fields = ds_get_field_settings($node->entity_type, $node->type, 'search_result');
    if (!empty($fields) && isset($fields['search_snippet'])) {
      // Because the 'search_result' display is being built right now (and because it is being overridden by Display Suite),
      // it is necessary to use the 'search_index' display for rendered field content.
      $build = node_view($node, 'search_index');
      unset($build['#theme']);
      // Render the node.
      $rendered = drupal_render($build);
      // Attach extra information to the rendered output.
      $rendered .= ' ' . $node->search_extra;
      // Generate the snippet based on rendered content.
      $node->snippet = search_excerpt($keys, $rendered);
    }
    $results[$item->sid] = $node;
  }
  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.