You are here

function apachesolr_search_search in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 5.2 apachesolr_search.module \apachesolr_search_search()
  2. 5 apachesolr_search.module \apachesolr_search_search()
  3. 6.3 apachesolr_search.module \apachesolr_search_search()
  4. 6 apachesolr_search.module \apachesolr_search_search()

Implementation of hook_search().

File

./apachesolr_search.module, line 110
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;
      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
}