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
|
class PostSearchParser extends AbstractSearchParser
|
||||||
{
|
{
|
||||||
private $tags;
|
private $tags;
|
||||||
private $showHidden = false;
|
private $showHidden;
|
||||||
private $showDisliked = false;
|
private $showDisliked;
|
||||||
private $randomReset = true;
|
private $randomReset;
|
||||||
|
|
||||||
protected function processSetup(&$tokens)
|
protected function processSetup(&$tokens)
|
||||||
{
|
{
|
||||||
$config = Core::getConfig();
|
$config = Core::getConfig();
|
||||||
|
|
||||||
|
$this->showHidden = false;
|
||||||
|
$this->showDisliked = false;
|
||||||
|
$this->randomReset = true;
|
||||||
$this->tags = [];
|
$this->tags = [];
|
||||||
$crit = Sql\Functors::conjunction();
|
$crit = Sql\Functors::conjunction();
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ use \Chibi\Sql as Sql;
|
||||||
|
|
||||||
abstract class AbstractSearchService
|
abstract class AbstractSearchService
|
||||||
{
|
{
|
||||||
protected static $parser;
|
private static $parsers = [];
|
||||||
|
|
||||||
public static function getEntities($searchQuery, $perPage = null, $page = 1)
|
public static function getEntities($searchQuery, $perPage = null, $page = 1)
|
||||||
{
|
{
|
||||||
|
@ -42,10 +42,11 @@ abstract class AbstractSearchService
|
||||||
|
|
||||||
public static function getParser()
|
public static function getParser()
|
||||||
{
|
{
|
||||||
|
$key = get_called_class();
|
||||||
$parserClassName = self::getParserClassName();
|
$parserClassName = self::getParserClassName();
|
||||||
if (self::$parser == null)
|
if (!isset(self::$parsers[$key]))
|
||||||
self::$parser = new $parserClassName();
|
self::$parsers[$key] = new $parserClassName();
|
||||||
return self::$parser;
|
return self::$parsers[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getModelClassName()
|
protected static function getModelClassName()
|
||||||
|
|
Loading…
Reference in a new issue