function apachesolr_search_search in Apache Solr Search 6
Same name and namespace in other branches
- 5.2 apachesolr_search.module \apachesolr_search_search()
- 5 apachesolr_search.module \apachesolr_search_search()
- 6.3 apachesolr_search.module \apachesolr_search_search()
- 6.2 apachesolr_search.module \apachesolr_search_search()
Implementation of hook_search().
File
- ./
apachesolr_search.module, line 111 - Provides a content search implementation for node content for use with the Apache Solr search application.
Code
function apachesolr_search_search($op = 'search', $keys = NULL) {
switch ($op) {
case 'name':
return t('Search');
case 'reset':
apachesolr_clear_last_index('apachesolr_search');
return;
case 'status':
return apachesolr_index_status('apachesolr_search');
case 'search':
$filters = isset($_GET['filters']) ? $_GET['filters'] : '';
$solrsort = isset($_GET['solrsort']) ? $_GET['solrsort'] : '';
$page = isset($_GET['page']) ? $_GET['page'] : 0;
if ($keys) {
// Don't allow local params to pass through to EDismax from the url.
// We also remove any remaining leading {! since that causes a parse
// error in Solr.
$keys = preg_replace('/^(?:{![^}]*}\\s*)*(?:{!\\s*)*/', ' ', $keys);
}
try {
$results = apachesolr_search_execute($keys, $filters, $solrsort, 'search/' . arg(1), $page);
return $results;
} catch (Exception $e) {
watchdog('Apache Solr', nl2br(check_plain($e
->getMessage())), NULL, WATCHDOG_ERROR);
apachesolr_failure(t('Solr search'), $keys);
}
break;
}
// switch
}