You are here

function search_log_preprocess_search_results in Search Log 6

Same name and namespace in other branches
  1. 7 search_log.module \search_log_preprocess_search_results()

Process search results.

The $variables array contains the following arguments:

  • $results
  • $type

Search does not have a hook to obtain the number of search results. This theme function is called only if there are results. In addition, some modules may bypass this function if it implements the op search_page.

See also

search_view(), search_data(), template_preprocess_search_results()

File

./search_log.module, line 195
Replaces default report of top search phrases.

Code

function search_log_preprocess_search_results(&$variables) {
  if (!variable_get('search_log_preprocess', FALSE)) {
    return;
  }
  $keys = urldecode(arg(2));
  $module = $variables['type'];
  $today = _search_log_get_time();
  $result = count($variables['results']);
  if ($qid = db_result(db_query("SELECT qid FROM {search_log} WHERE q='%s' AND module='%s' AND day=%d", $keys, $module, $today))) {
    db_query("UPDATE {search_log} SET result = %d WHERE qid = %d", $result, $qid);
  }
}