Commit 08bec685 authored by zYne's avatar zYne

--no commit message

--no commit message
parent f8e2c314
...@@ -66,9 +66,9 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -66,9 +66,9 @@ class Doctrine_Search extends Doctrine_Plugin
{ {
$q = new Doctrine_Search_Query($this->_options['pluginTable']); $q = new Doctrine_Search_Query($this->_options['pluginTable']);
$q->search($query); $q->query($query);
return $q->execute(); return $this->_options['connection']->fetchAll($q->getSql(), $q->getParams());;
} }
public function analyze($text) public function analyze($text)
...@@ -145,7 +145,7 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -145,7 +145,7 @@ class Doctrine_Search extends Doctrine_Plugin
public function processPending($limit = null, $offset = null) public function batchUpdateIndex($limit = null, $offset = null)
{ {
$this->buildDefinition(); $this->buildDefinition();
...@@ -215,8 +215,6 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -215,8 +215,6 @@ class Doctrine_Search extends Doctrine_Plugin
return false; return false;
} }
$columns = array('keyword' => array('type' => 'string', $columns = array('keyword' => array('type' => 'string',
'length' => 200, 'length' => 200,
'primary' => true, 'primary' => true,
......
...@@ -32,10 +32,7 @@ ...@@ -32,10 +32,7 @@
*/ */
class Doctrine_Search_Query class Doctrine_Search_Query
{ {
/**
* @var Doctrine_Query $query the base query
*/
protected $_query;
/** /**
* @var Doctrine_Table $_table the index table * @var Doctrine_Table $_table the index table
*/ */
...@@ -48,32 +45,27 @@ class Doctrine_Search_Query ...@@ -48,32 +45,27 @@ class Doctrine_Search_Query
protected $_condition; protected $_condition;
/** /**
* @param octrine_Table $_table the index table * @param Doctrine_Table $_table the index table
*/ */
public function __construct($table) public function __construct($table)
{ {
if (is_string($table)) { if (is_string($table)) {
$table = Doctrine_Manager::table($table); $table = Doctrine_Manager::table($table);
} else {
if ( ! $table instanceof Doctrine_Table) {
throw new Doctrine_Search_Exception('Invalid argument type. Expected instance of Doctrine_Table.');
}
} }
$this->_table = $table; $this->_table = $table;
$this->_query = new Doctrine_Query();
$foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position'))); $foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position')));
$this->_condition = $foreignId . ' %s (SELECT ' . $foreignId . ' FROM ' . $this->_table->getTableName() . ' WHERE '; $this->_condition = $foreignId . ' %s (SELECT ' . $foreignId . ' FROM ' . $this->_table->getTableName() . ' WHERE ';
} }
/**
* getQuery
*
* @return Doctrine_Query returns the query object associated with this object
*/
public function getQuery()
{
return $this->_query;
}
public function search($text)
public function query($text)
{ {
$text = trim($text); $text = trim($text);
...@@ -228,10 +220,4 @@ class Doctrine_Search_Query ...@@ -228,10 +220,4 @@ class Doctrine_Search_Query
{ {
return $this->_sql; return $this->_sql;
} }
public function execute()
{
$resultSet = $this->_query->execute();
return $resultSet;
}
} }
...@@ -62,8 +62,8 @@ class Doctrine_Template_Searchable extends Doctrine_Template ...@@ -62,8 +62,8 @@ class Doctrine_Template_Searchable extends Doctrine_Template
$this->addListener(new Doctrine_Search_Listener($this->_plugin)); $this->addListener(new Doctrine_Search_Listener($this->_plugin));
} }
public function processPending($limit = null, $offset = null) public function batchUpdateIndex($limit = null, $offset = null)
{ {
$this->_plugin->processPending($limit, $offset); $this->_plugin->batchUpdateIndex($limit, $offset);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment