You are here

function apachesolr_search_form_search_submit in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_form_search_submit()
  2. 5.2 apachesolr_search.module \apachesolr_search_form_search_submit()
  3. 6 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()

1 string reference to 'apachesolr_search_form_search_submit'
apachesolr_search_form_search_form_alter in ./apachesolr_search.module
Implementation of hook_form_[form_id]_alter().

File

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

Code

function apachesolr_search_form_search_submit($form, &$form_state) {
  $fv = $form_state['values'];
  $keys = $fv['processed_keys'];
  $base = 'search/' . $fv['module'] . '/';
  if (variable_get('clean_url', '0')) {
    $keys = str_replace('+', '%2B', $keys);
  }
  $get = json_decode($fv['apachesolr_search']['get'], TRUE);
  $queryvalues = json_decode($fv['apachesolr_search']['queryvalues'], TRUE);
  if (!empty($fv['apachesolr_search']['retain-filters']) && $queryvalues) {
    $get = $queryvalues + $get;
    $get['retain-filters'] = '1';
  }
  $form_state['redirect'] = array(
    $base . $keys,
    $get,
  );

  // TODO decide if we want to make the facet blocks in the well an option.
  //  if ($keys == '' && !$queryvalues) {
  //    form_set_error('keys', t('Please enter some keywords.'));
  //  }
}