Files
Phraseanet/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/FieldMatchExpression.php
Mathieu Darse e86918de4b Merge native keys, flag & fields syntaxes together (PHRAS-685)
- « IN » syntax was removed
- Tests where updated with new serialized representations (IN is replaced by MATCHES)
- Removed tests of native fields with IN syntax
- 4 tests (lines 77, 80, 83 and 86 in queries.csv) are not passing but
they were not really part of specified functionality. They need some work eventually.
2015-10-12 19:50:23 +02:00

35 lines
780 B
PHP

<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
class FieldMatchExpression extends Node
{
protected $field;
protected $expression;
public function __construct(Field $field, $expression)
{
$this->field = $field;
$this->expression = $expression;
}
public function buildQuery(QueryContext $context)
{
$fields = array($this->field->getValue());
return $this->expression->buildQuery($context->narrowToFields($fields));
}
public function getTermNodes()
{
return $this->expression->getTermNodes();
}
public function __toString()
{
return sprintf('(%s MATCHES %s)', $this->field, $this->expression);
}
}