You are here

function apachesolr_search_execute in Apache Solr Search 5.2

Same name and namespace in other branches
  1. 6 apachesolr_search.module \apachesolr_search_execute()
  2. 6.2 apachesolr_search.module \apachesolr_search_execute()

Execute a search results based on keyword, filter, and sort strings.

Throws

Exception

3 calls to apachesolr_search_execute()
apachesolr_drush_solr_search in ./apachesolr.drush.inc
apachesolr_search_search in ./apachesolr_search.module
Implementation of hook_search().
apachesolr_search_taxonomy_term_page in ./apachesolr.taxonomy.inc
Overrides taxonomy/term/X links

File

./apachesolr_search.module, line 170
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_execute($keys, $filters, $solrsort, $base_path = '', $page = 0, $caller = 'apachesolr_search') {
  $params = array();

  // This is the object that knows about the query coming from the user.
  $query = apachesolr_drupal_query($keys, $filters, $solrsort, $base_path);
  if (empty($query)) {
    throw new Exception(t('Could not construct a Solr query in function apachesolr_search_search()'));
  }
  $params += apachesolr_search_basic_params($query);
  if ($keys) {
    $params += apachesolr_search_highlighting_params($query);
    $params += apachesolr_search_spellcheck_params($query);
  }
  else {

    // No highlighting, use the teaser as a snippet.
    $params['fl'] .= ',teaser';
  }
  apachesolr_search_add_facet_params($params, $query);
  apachesolr_search_add_boost_params($params, $query, apachesolr_get_solr());
  list($final_query, $response) = apachesolr_do_query($caller, $query, $params, $page);
  apachesolr_has_searched(TRUE);

  // Add search terms and filters onto the breadcrumb.
  // We use the original $query to avoid exposing, for example, nodeaccess
  // filters in the breadcrumb.
  drupal_set_breadcrumb(array_merge(menu_get_active_breadcrumb(), $query
    ->get_breadcrumb()));
  return apachesolr_process_response($response, $final_query, $params);
}