Fixed problems with persistent search parser cache
This commit is contained in:
parent
d45a590531
commit
f52e97e08a
2 changed files with 11 additions and 7 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue