Skip to content

Commit

Permalink
Merge pull request #1013 from tractorcow/pulls/3.2-fix-fulltext-query…
Browse files Browse the repository at this point in the history
…-encoding

BUG Fix encoding of SearchForm::getSearchQuery
  • Loading branch information
Stig Lindqvist committed Jun 14, 2014
2 parents 1a85c7a + 5dd0583 commit 30d42e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion code/search/ContentControllerSearchExtension.php
Expand Up @@ -42,7 +42,7 @@ public function SearchForm() {
public function results($data, $form, $request) { public function results($data, $form, $request) {
$data = array( $data = array(
'Results' => $form->getResults(), 'Results' => $form->getResults(),
'Query' => $form->getSearchQuery(), 'Query' => DBField::create_field('Text', $form->getSearchQuery()),
'Title' => _t('SearchForm.SearchResults', 'Search Results') 'Title' => _t('SearchForm.SearchResults', 'Search Results')
); );
return $this->owner->customise($data)->renderWith(array('Page_results', 'Page')); return $this->owner->customise($data)->renderWith(array('Page_results', 'Page'));
Expand Down
6 changes: 5 additions & 1 deletion code/search/SearchForm.php
Expand Up @@ -27,6 +27,10 @@ class SearchForm extends Form {
"SiteTree", "File" "SiteTree", "File"
); );


private static $casting = array(
'SearchQuery' => 'Text'
);

/** /**
* *
* @param Controller $controller * @param Controller $controller
Expand Down Expand Up @@ -186,7 +190,7 @@ public function getSearchQuery($data = null) {
if(!isset($data)) $data = $_REQUEST; if(!isset($data)) $data = $_REQUEST;


// The form could be rendered without the search being done, so check for that. // The form could be rendered without the search being done, so check for that.
if (isset($data['Search'])) return Convert::raw2xml($data['Search']); if (isset($data['Search'])) return $data['Search'];
} }


/** /**
Expand Down

0 comments on commit 30d42e0

Please sign in to comment.