function apachesolr_search_ds_search_execute in Display Suite 7
Search on behalf of Apache Solr.
File
- modules/
ds_search/ ds_search.module, line 653 - Display Suite search.
Code
function apachesolr_search_ds_search_execute($keys = NULL, $conditions = NULL) {
$find = apachesolr_search_search_execute($keys, $conditions);
$results = array();
// Make sure apachesolr_search_browse is not rendered.
if (isset($find['apachesolr_search_browse'])) {
unset($find['apachesolr_search_browse']);
}
if (empty($find)) {
return array();
}
foreach ($find as $item) {
// Unserialize tm_node field.
$node = @unserialize(urldecode($item['fields']['tm_node'][0]));
if (!isset($node->nid)) {
$node = node_load($item['node']->entity_id);
}
// Add the snippet, url and extra info on the object.
$node->search_snippet = $item['snippet'];
$node->search_extra = $item['extra'];
$node->search_as_url = $item['fields']['url'];
// Apache Solr multisite support.
if (variable_get('ds_search_apachesolr_multisite')) {
// Pass along the uri path in case some people want to
// do cool stuff themselves.
$node->uri['path'] = $node->search_as_url;
$node->uri['options'] = array();
// Prefix with site hash so we don't override same id's.
$markup = $item['fields']['tm_ds_search_result'][0];
$results[$item['fields']['id'] . '-' . $item['node']->entity_id] = array(
'#markup' => $markup,
'#site_hash' => $item['fields']['hash'],
);
}
else {
$results[$item['node']->entity_id] = $node;
}
}
return $results;
}