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
{
$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)
......@@ -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();
......@@ -215,8 +215,6 @@ class Doctrine_Search extends Doctrine_Plugin
return false;
}
$columns = array('keyword' => array('type' => 'string',
'length' => 200,
'primary' => true,
......
......@@ -32,10 +32,7 @@
*/
class Doctrine_Search_Query
{
/**
* @var Doctrine_Query $query the base query
*/
protected $_query;
/**
* @var Doctrine_Table $_table the index table
*/
......@@ -48,35 +45,30 @@ class Doctrine_Search_Query
protected $_condition;
/**
* @param octrine_Table $_table the index table
* @param Doctrine_Table $_table the index table
*/
public function __construct($table)
{
if (is_string($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->_query = new Doctrine_Query();
$foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position')));
$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);
$foreignId = current(array_diff($this->_table->getColumnNames(), array('keyword', 'field', 'position')));
$weighted = false;
......@@ -228,10 +220,4 @@ class Doctrine_Search_Query
{
return $this->_sql;
}
public function execute()
{
$resultSet = $this->_query->execute();
return $resultSet;
}
}
\ No newline at end of file
}
......@@ -61,9 +61,9 @@ class Doctrine_Template_Searchable extends Doctrine_Template
$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