From ac608190c6eb3140b48a0e11fdb8444419a90fb9 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Fri, 25 Feb 2011 11:53:17 +1300 Subject: [PATCH] MINOR: update links to use atom rather than RSS --- code/DocumentationSearch.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/code/DocumentationSearch.php b/code/DocumentationSearch.php index 1874869..a735932 100644 --- a/code/DocumentationSearch.php +++ b/code/DocumentationSearch.php @@ -218,7 +218,8 @@ class DocumentationSearch { 'Version' => DBField::create('Varchar',$doc->getFieldValue('Version')), 'Content' => DBField::create('HTMLText', $content), 'Score' => $hit->score, - 'Number' => $k + 1 + 'Number' => $k + 1, + 'ID' => md5($doc->getFieldValue('Link')) )); $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() { if(!$this->results) $this->performSearch(); 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'); - if($request->requestVar('format') && $request->requestVar('format') == "rss") { + if($request->requestVar('format') && $request->requestVar('format') == "atom") { // alter the fields for the opensearch xml. $title = ($title = $this->getTitle()) ? ' - '. $title : ""; @@ -389,7 +394,7 @@ class DocumentationOpenSearch_Controller extends Controller { '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')); }