You are here

function google_appliance_search in Google Search Appliance 6.2

Same name and namespace in other branches
  1. 5 google_appliance.module \google_appliance_search()

Implementation of hook_search().

Parameters

string $op: Operation - name, reset, search, status

string $keys: Keyword string sent to the search

array $options: Optional set of QueryPart arguments: $gm->setQueryPart($key, $value);

string $collection: Specify which collection to search

string $client: Specify which client (front end) to use

Return value

Array of search results (each is an assoc. array) that can be fed to a theme function

1 call to google_appliance_search()
google_appliance_search_view in ./google_appliance.module
Search page results.

File

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

Code

function google_appliance_search($op = 'search', $keys = NULL, $options = array(), $collection = '', $client = '') {
  switch ($op) {
    case 'name':
      return t(variable_get('google_appliance_name', GOOGLE_APPLIANCE_NAME_DEFAULT));
    case 'search':
      $dir = drupal_get_path('module', 'google_appliance');
      include_once $dir . '/DrupalGoogleMini.php';
      $google_debug = variable_get('google_appliance_debug', 0);
      if ($google_debug >= 2) {
        $gm = new DrupalGoogleMini(TRUE, 'dpr');
      }
      elseif ($google_debug == 1) {
        $gm = new DrupalGoogleMini(TRUE);
      }
      else {
        $gm = new DrupalGoogleMini(FALSE);
      }

      // Initialise the search object.
      $init = _google_appliance_search_initialise($gm, $client, $collection, $keys, $options);
      if ($init !== NULL) {
        return $init;

        // Initialisation error.
      }

      // Perform the search.
      return _google_appliance_search($gm);
  }
}