mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
BUGFIX: fixed link to search query from opensearch description
This commit is contained in:
parent
13fdb8dd80
commit
94121f0a66
@ -193,7 +193,6 @@ class DocumentationSearch {
|
||||
|
||||
$start = ($request->requestVar('start')) ? (int)$request->requestVar('start') : 0;
|
||||
$query = ($request->requestVar('Search')) ? $request->requestVar('Search') : '';
|
||||
|
||||
|
||||
$currentPage = floor( $start / $pageLength ) + 1;
|
||||
|
||||
@ -226,7 +225,7 @@ class DocumentationSearch {
|
||||
}
|
||||
|
||||
$data['Results'] = $results;
|
||||
$data['Query'] = DBField::create('Text', $query);
|
||||
$data['Query'] = DBField::create('Text', $query);
|
||||
$data['TotalResults'] = DBField::create('Text', count($this->results));
|
||||
$data['TotalPages'] = DBField::create('Text', $totalPages);
|
||||
$data['ThisPage'] = DBField::create('Text', $currentPage);
|
||||
@ -344,13 +343,14 @@ class DocumentationSearch {
|
||||
if(!$this->outputController) return user_error('Call renderResults() on a DocumentationViewer instance.', E_USER_ERROR);
|
||||
|
||||
$request = $this->outputController->getRequest();
|
||||
|
||||
|
||||
$data = $this->getSearchResults($request);
|
||||
|
||||
$templates = array('DocumentationViewer_results', 'DocumentationViewer');
|
||||
|
||||
if($request->requestVar('format') && $request->requestVar('format') == "rss") {
|
||||
// alter the fields for the opensearch xml.
|
||||
$title = ($title = $this->getTitle()) ? ' | '. $title : "";
|
||||
$title = ($title = $this->getTitle()) ? ' - '. $title : "";
|
||||
|
||||
$link = Controller::join_links($this->outputController->Link(), 'DocumentationOpenSearch_Controller/description/');
|
||||
|
||||
@ -386,7 +386,7 @@ class DocumentationOpenSearch_Controller extends Controller {
|
||||
$link = Director::absoluteBaseUrl() .
|
||||
$data['SearchPageLink'] = Controller::join_links(
|
||||
$viewer->Link(),
|
||||
'results/?query={searchTerms}&start={startIndex}&length={count}'
|
||||
'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1'
|
||||
);
|
||||
|
||||
$data['SearchPageRss'] = $data['SearchPageLink'] . '&format=rss';
|
||||
|
@ -716,9 +716,14 @@ class DocumentationViewer extends Controller {
|
||||
/**
|
||||
* Past straight to results, display and encode the query
|
||||
*/
|
||||
function results($data, $form, $request) {
|
||||
function results($data, $form = false) {
|
||||
|
||||
$query = (isset($_REQUEST['Search'])) ? $_REQUEST['Search'] : false;
|
||||
|
||||
if(!$query) return $this->httpError('404');
|
||||
|
||||
$search = new DocumentationSearch();
|
||||
$search->setQuery($form->dataFieldByName('Search')->dataValue());
|
||||
$search->setQuery($query);
|
||||
$search->setOutputController($this);
|
||||
|
||||
return $search->renderResults();
|
||||
|
Loading…
Reference in New Issue
Block a user