function hook_google_appliance_query_alter in Google Search Appliance 7
Same name and namespace in other branches
- 8 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
$query: The search query, represented as multi-dimensional, associative array just before it is sent to the search appliance.
See also
google_appliance_search_view()
https://developers.google.com/search-appliance/documentation/614/xml_ref...
Related topics
1 invocation of hook_google_appliance_query_alter()
- google_appliance_search_view in ./
google_appliance.module - Top level search execution (menu callback)
File
- ./
google_appliance.api.php, line 44 - This file contains no working PHP code; it exists to provide additional documentation for doxygen as well as to document hooks in the standard Drupal manner.
Code
function hook_google_appliance_query_alter(&$query) {
// Only return English language results.
$query['gsa_query_params']['lr'] = 'en';
// Alter the appliance host.
$query['gsa_host'] = 'http://gsa.example.com';
}