You are here

function hook_google_appliance_query_alter in Google Search Appliance 8

Same name and namespace in other branches
  1. 7 google_appliance.api.php \hook_google_appliance_query_alter()

Alter Google Search Appliance queries.

This hook is invoked after Google Search Appliance builds the query, just before the query is sent to the appliance.

Use this to alter which collection is queried, which frontend is used, add meta tag constraints, restrict queries to specific languages, etc. A complete list of search parameters is available in the Google developer documentation referenced below.

Parameters

array $params: The search params before they're sent to the host.

See also

\Drupal\google_appliance\Service\Search::search

https://developers.google.com/search-appliance/documentation/614/xml_ref...

Related topics

1 invocation of hook_google_appliance_query_alter()
Search::search in src/Service/Search.php
Performs search.

File

./google_appliance.api.php, line 48
Hook documentation.

Code

function hook_google_appliance_query_alter(array &$params) {

  // Only return English language results.
  $params['lr'] = 'en';
}