You are here

function google_appliance_search_view in Google Search Appliance 6.2

Same name and namespace in other branches
  1. 7 google_appliance.module \google_appliance_search_view()

Search page results.

Parameters

string $search_base: The base search path (i.e. minus $keys).

string $client: The Google front end to use.

string $collection: The Google collection to search.

string $keys: Keyword string sent to the search

Return value

Themed search results.

1 string reference to 'google_appliance_search_view'
google_appliance_menu in ./google_appliance.module
Implementation of hook_menu().

File

./google_appliance.module, line 1088
Google Search Appliance (GSA) / Google Mini integration

Code

function google_appliance_search_view($search_base, $client, $collection, $keys = NULL, $title = NULL) {
  $form = drupal_get_form('google_appliance_search_form', NULL, $search_base, $client, $collection, $keys);

  // When POSTing back to an existing search-results page, the original
  // URL is accessed (which re-runs that search) and then the redirect for
  // the new search takes place and a second (correct) search is executed.
  // We can avoid this issue in the same manner as search_view()
  if (!isset($_POST['form_id'])) {
    $search_view = array(
      'client' => $client,
      'collection' => $collection,
      'keys' => $keys,
      'search_base' => $search_base,
      'form' => $form,
      'results' => google_appliance_search('search', $keys, array(), $collection, $client),
      // google_appliance_cache_data() depends upon google_appliance_search()
      'keymatches' => google_appliance_cache_data('keymatches'),
      'synonyms' => google_appliance_cache_data('synonyms'),
    );
    return theme('google_appliance_search_view', $search_view, $title);
  }
  else {
    return $form;
  }
}