function apachesolr_panels_search_execute in Apache Solr Panels 6
Same name and namespace in other branches
- 6.3 apachesolr_panels.module \apachesolr_panels_search_execute()
- 7 apachesolr_panels.module \apachesolr_panels_search_execute()
Execute a Solr search.
Using hook_search() would make this module a first-class search module alongside Apache Solr Search, which we don't want. Instead, we execute the search directly and imitate what the core Search module does.
See also
1 call to apachesolr_panels_search_execute()
- apachesolr_panels_apachesolr_result_content_type_render in plugins/
content_types/ apachesolr_result.inc - Render the search results.
File
- ./
apachesolr_panels.module, line 89 - Integrates Apache Solr Search with Panels.
Code
function apachesolr_panels_search_execute($search) {
// Store information about the search for use in other panes.
apachesolr_panels_static_search_cache($search);
$results = NULL;
try {
$results = apachesolr_search_execute($search['keys'], $search['filters'], $search['sort'], $search['path'], $search['page']);
} catch (Exception $e) {
watchdog('Apache Solr', nl2br(check_plain($e
->getMessage())), NULL, WATCHDOG_ERROR);
apachesolr_failure(t('Solr search'), $search['keys']);
}
// Imitate search_data() to present the results as Apache Solr Search would.
if (is_array($results) && count($results)) {
if (module_hook('apachesolr_search', 'search_page')) {
return module_invoke('apachesolr_search', 'search_page', $results);
}
else {
return theme('search_results', $results, 'apachesolr_search');
}
}
}