mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 05:53:13 +00:00
BooleanOperator → BooleanExpression
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\Boolean;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
||||||
|
|
||||||
class AndOperator extends BinaryOperator
|
class AndExpression extends BinaryExpression
|
||||||
{
|
{
|
||||||
protected $operator = 'AND';
|
protected $operator = 'AND';
|
||||||
|
|
@@ -4,7 +4,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\Boolean;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\AST\Node;
|
use Alchemy\Phrasea\SearchEngine\Elastic\AST\Node;
|
||||||
|
|
||||||
abstract class BinaryOperator extends Node
|
abstract class BinaryExpression extends Node
|
||||||
{
|
{
|
||||||
protected $left;
|
protected $left;
|
||||||
protected $right;
|
protected $right;
|
@@ -4,7 +4,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\Boolean;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
||||||
|
|
||||||
class ExceptOperator extends BinaryOperator
|
class ExceptExpression extends BinaryExpression
|
||||||
{
|
{
|
||||||
protected $operator = 'EXCEPT';
|
protected $operator = 'EXCEPT';
|
||||||
|
|
@@ -4,7 +4,7 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic\AST\Boolean;
|
|||||||
|
|
||||||
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
||||||
|
|
||||||
class OrOperator extends BinaryOperator
|
class OrExpression extends BinaryExpression
|
||||||
{
|
{
|
||||||
protected $operator = 'OR';
|
protected $operator = 'OR';
|
||||||
|
|
@@ -125,21 +125,21 @@ class QueryVisitor implements Visit
|
|||||||
private function visitAndNode(Element $element)
|
private function visitAndNode(Element $element)
|
||||||
{
|
{
|
||||||
return $this->handleBinaryExpression($element, function($left, $right) {
|
return $this->handleBinaryExpression($element, function($left, $right) {
|
||||||
return new AST\Boolean\AndOperator($left, $right);
|
return new AST\Boolean\AndExpression($left, $right);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function visitOrNode(Element $element)
|
private function visitOrNode(Element $element)
|
||||||
{
|
{
|
||||||
return $this->handleBinaryExpression($element, function($left, $right) {
|
return $this->handleBinaryExpression($element, function($left, $right) {
|
||||||
return new AST\Boolean\OrOperator($left, $right);
|
return new AST\Boolean\OrExpression($left, $right);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private function visitExceptNode(Element $element)
|
private function visitExceptNode(Element $element)
|
||||||
{
|
{
|
||||||
return $this->handleBinaryExpression($element, function($left, $right) {
|
return $this->handleBinaryExpression($element, function($left, $right) {
|
||||||
return new AST\Boolean\ExceptOperator($left, $right);
|
return new AST\Boolean\ExceptExpression($left, $right);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ class QueryVisitor implements Visit
|
|||||||
throw new Exception('Unexpected context after non-contextualizable node');
|
throw new Exception('Unexpected context after non-contextualizable node');
|
||||||
}
|
}
|
||||||
} elseif ($node instanceof AST\Node) {
|
} elseif ($node instanceof AST\Node) {
|
||||||
$root = new AST\Boolean\AndOperator($root, $node);
|
$root = new AST\Boolean\AndExpression($root, $node);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('Unexpected node type inside text node.');
|
throw new Exception('Unexpected node type inside text node.');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user