BooleanOperator → BooleanExpression

This commit is contained in:
Mathieu Darse
2015-11-10 14:56:50 +01:00
parent 9f923e0409
commit c89d48c6f7
5 changed files with 8 additions and 8 deletions

View File

@@ -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';

View File

@@ -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;

View File

@@ -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';

View File

@@ -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';

View File

@@ -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.');
} }