search_query_insert

Versions
5 – 6
search_query_insert($keys, $option, $value = '')

Return a query with the given module-specific search option inserted in. e.g. 'type:book'.

▾ 5 functions call search_query_insert()

hook_search in hooks/core.php
Define a custom search routine.
location_search_validate in contrib/location/contrib/location_search/location_search.module
node_search in core/modules/node/node.module
Implementation of hook_search().
node_search_validate in core/modules/node/node.module
Form API callback for the search form. Registered in node_form_alter().
_location_search in contrib/location/contrib/location_search/location_search.module
Implementation of hook_search(). (forwarded from location.module)

Code

core/modules/search/search.module, line 680

<?php
function search_query_insert($keys, $option, $value = '') {
  if (search_query_extract($keys, $option)) {
    $keys = trim(preg_replace('/(^| )'. $option .':[^ ]*/i', '', $keys));
  }
  if ($value != '') {
    $keys .= ' '. $option .':'. $value;
  }
  return $keys;
}
?>