You are here

function apachesolr_search_form_search_submit in Apache Solr Search 5.2

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_form_search_submit()
  2. 6 apachesolr_search.module \apachesolr_search_form_search_submit()
  3. 6.2 apachesolr_search.module \apachesolr_search_form_search_submit()
  4. 7 apachesolr_search.module \apachesolr_search_form_search_submit()

Added form submit function to account for Apache mode_rewrite quirks.

See also

apachesolr_search_form_search_form_alter()

File

./apachesolr_search.module, line 824
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_form_search_submit($form_id, $form_values) {
  $fv = $form_values;
  $keys = $fv['processed_keys'];
  $base = 'search/' . $fv['module'] . '/';
  if (variable_get('clean_url', '0')) {
    $keys = str_replace('+', '%2B', $keys);
  }
  $get = unserialize($fv['apachesolr_search']['get']);
  $queryvalues = unserialize($fv['apachesolr_search']['queryvalues']);
  if (!empty($fv['apachesolr_search']['retain-filters']) && $queryvalues) {
    $get = $queryvalues + $get;
    $get['retain-filters'] = '1';
  }
  if ($keys == '' && !$queryvalues) {
    form_set_error('keys', t('Please enter some keywords.'));
  }
  if (empty($get) || !is_array($get)) {
    return $base . $keys;
  }
  else {
    return array(
      $base . $keys,
      drupal_query_string_encode($get),
    );
  }
}