From 30eddf57c8de433e8ea02b9e552c8e1744a505a7 Mon Sep 17 00:00:00 2001 From: wei <> Date: Sun, 7 May 2006 03:34:25 +0000 Subject: Add search to quickstart demo. --- demos/quickstart/protected/index/ZendSearch.php | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 demos/quickstart/protected/index/ZendSearch.php (limited to 'demos/quickstart/protected/index/ZendSearch.php') diff --git a/demos/quickstart/protected/index/ZendSearch.php b/demos/quickstart/protected/index/ZendSearch.php new file mode 100644 index 00000000..136004de --- /dev/null +++ b/demos/quickstart/protected/index/ZendSearch.php @@ -0,0 +1,52 @@ +_data = Prado::getPathOfNamespace($path); + } + + public function getIndexDataDirectory() + { + return $this->_data; + } + + public function setZendFramework($path) + { + $this->_ZF = Prado::getPathOfNamespace($path); + } + + protected function importZendNamespace() + { + $zendBase = !is_null($this->_ZF) ? $this->_ZF.'.*' : 'Application.index.*'; + $path = !is_null($this->_ZF) ? $this->_ZF.'.Zend.*' : 'Application.index.Zend.*'; + Prado::using($zendBase); + Prado::setPathOfAlias('Zend', Prado::getPathOfNamespace($path)); + } + + protected function getZendSearch() + { + if(is_null($this->_search)) + { + $this->importZendNamespace(); + Prado::using('Zend.Search.Lucene'); + $this->_search = new Zend_Search_Lucene($this->_data); + } + return $this->_search; + } + + public function find($query) + { + return $this->getZendSearch()->find(strtolower($query)); + } +} + +?> \ No newline at end of file -- cgit v1.2.3