summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/index/ZendSearch.php
diff options
context:
space:
mode:
authorxue <>2006-05-09 12:11:38 +0000
committerxue <>2006-05-09 12:11:38 +0000
commitf4de82bcdafba51e4eed9cae6b2d3e5375ffd115 (patch)
tree08f98e1763e87f0639961c6da33224082345c7c3 /demos/quickstart/protected/index/ZendSearch.php
parent92dca3315f083f00dcff610ea207af52284d0616 (diff)
Diffstat (limited to 'demos/quickstart/protected/index/ZendSearch.php')
-rw-r--r--demos/quickstart/protected/index/ZendSearch.php52
1 files changed, 52 insertions, 0 deletions
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 @@
+<?php
+/*
+ * Created on 7/05/2006
+ */
+
+class ZendSearch extends TModule
+{
+ private $_data;
+ private $_ZF;
+ private $_search;
+
+ public function setIndexDataDirectory($path)
+ {
+ $this->_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