Browse Source

less encoding decoding

2.x
Paul Pound 1 year ago
parent
commit
d76a9d875a
  1. 4
      modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php
  2. 6
      src/Form/RoblibSearchForm.php

4
modules/solr_site/src/Controller/RoblibSearchSolrsiteController.php

@ -48,7 +48,7 @@ class RoblibSearchSolrsiteController extends ControllerBase {
return ''; return '';
} }
} }
$queryString = urlencode($queryString); //$queryString = urlencode($queryString);
// TODO make the index configurable. // TODO make the index configurable.
$index = \Drupal\search_api\Entity\Index::load('library'); $index = \Drupal\search_api\Entity\Index::load('library');
$query = $index->query(); $query = $index->query();
@ -62,7 +62,7 @@ class RoblibSearchSolrsiteController extends ControllerBase {
// Restrict the search to specific languages. // Restrict the search to specific languages.
//$query->setLanguages(['en']); //$query->setLanguages(['en']);
$query->keys($queryString); $query->keys($queryString);
if ($solr_type == 'BestBet') { if ($solr_type == 'BestBet') {
$query->addCondition('type', 'bestbet', '='); $query->addCondition('type', 'bestbet', '=');

6
src/Form/RoblibSearchForm.php

@ -59,7 +59,7 @@ class RoblibSearchForm extends FormBase{
* {@inheritdoc} * {@inheritdoc}
*/ */
public function validateForm(array &$form, FormStateInterface $form_state) { public function validateForm(array &$form, FormStateInterface $form_state) {
} }
/** /**
@ -67,14 +67,14 @@ class RoblibSearchForm extends FormBase{
*/ */
public function submitForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) {
$search_string = $form_state->getValue('roblib_search_simple_search_query'); $search_string = $form_state->getValue('roblib_search_simple_search_query');
$search_string = Html::escape($search_string); //$search_string = Html::escape($search_string);
$message = Message::create(['template' => 'roblib_search_message_template', $message = Message::create(['template' => 'roblib_search_message_template',
'uid' => \Drupal::currentUser()->id()]); 'uid' => \Drupal::currentUser()->id()]);
$message->set('field_ip_address', \Drupal::request()->getClientIp()); $message->set('field_ip_address', \Drupal::request()->getClientIp());
$message->set('field_search_string', $search_string); $message->set('field_search_string', $search_string);
$message->save(); $message->save();
$url = Url::fromUserInput('/roblib_search/' . $search_string); $url = Url::fromUserInput('/roblib_search/' . $search_string);
$form_state->setRedirectUrl($url); $form_state->setRedirectUrl($url);
} }
} }

Loading…
Cancel
Save