Fixed problems with persistent search parser cache

This commit is contained in:
Marcin Kurczewski 2014-08-09 12:36:53 +02:00
parent d45a590531
commit f52e97e08a
2 changed files with 11 additions and 7 deletions

View file

@ -4,14 +4,17 @@ use \Chibi\Sql as Sql;
class PostSearchParser extends AbstractSearchParser
{
private $tags;
private $showHidden = false;
private $showDisliked = false;
private $randomReset = true;
private $showHidden;
private $showDisliked;
private $randomReset;
protected function processSetup(&$tokens)
{
$config = Core::getConfig();
$this->showHidden = false;
$this->showDisliked = false;
$this->randomReset = true;
$this->tags = [];
$crit = Sql\Functors::conjunction();

View file

@ -3,7 +3,7 @@ use \Chibi\Sql as Sql;
abstract class AbstractSearchService
{
protected static $parser;
private static $parsers = [];
public static function getEntities($searchQuery, $perPage = null, $page = 1)
{
@ -42,10 +42,11 @@ abstract class AbstractSearchService
public static function getParser()
{
$key = get_called_class();
$parserClassName = self::getParserClassName();
if (self::$parser == null)
self::$parser = new $parserClassName();
return self::$parser;
if (!isset(self::$parsers[$key]))
self::$parsers[$key] = new $parserClassName();
return self::$parsers[$key];
}
protected static function getModelClassName()