MINOR: update links to use atom rather than RSS

This commit is contained in:
Will Rossiter 2011-02-25 11:53:17 +13:00
parent 0ec206eff5
commit ac608190c6

View File

@ -218,7 +218,8 @@ class DocumentationSearch {
'Version' => DBField::create('Varchar',$doc->getFieldValue('Version')), 'Version' => DBField::create('Varchar',$doc->getFieldValue('Version')),
'Content' => DBField::create('HTMLText', $content), 'Content' => DBField::create('HTMLText', $content),
'Score' => $hit->score, 'Score' => $hit->score,
'Number' => $k + 1 'Number' => $k + 1,
'ID' => md5($doc->getFieldValue('Link'))
)); ));
$results->push($obj); $results->push($obj);
@ -338,6 +339,10 @@ class DocumentationSearch {
); );
} }
/**
* Renders the search results into a template. Either
* the search results template or the Atom feed
*/
public function renderResults() { public function renderResults() {
if(!$this->results) $this->performSearch(); if(!$this->results) $this->performSearch();
if(!$this->outputController) return user_error('Call renderResults() on a DocumentationViewer instance.', E_USER_ERROR); if(!$this->outputController) return user_error('Call renderResults() on a DocumentationViewer instance.', E_USER_ERROR);
@ -348,7 +353,7 @@ class DocumentationSearch {
$templates = array('DocumentationViewer_results', 'DocumentationViewer'); $templates = array('DocumentationViewer_results', 'DocumentationViewer');
if($request->requestVar('format') && $request->requestVar('format') == "rss") { if($request->requestVar('format') && $request->requestVar('format') == "atom") {
// alter the fields for the opensearch xml. // alter the fields for the opensearch xml.
$title = ($title = $this->getTitle()) ? ' - '. $title : ""; $title = ($title = $this->getTitle()) ? ' - '. $title : "";
@ -389,7 +394,7 @@ class DocumentationOpenSearch_Controller extends Controller {
'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1' 'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1'
); );
$data['SearchPageRss'] = $data['SearchPageLink'] . '&format=rss'; $data['SearchPageAtom'] = $data['SearchPageLink'] . '&format=atom';
return $this->customise(new ArrayData($data))->renderWith(array('OpenSearchDescription')); return $this->customise(new ArrayData($data))->renderWith(array('OpenSearchDescription'));
} }