mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00

- « 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.
35 lines
780 B
PHP
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);
|
|
}
|
|
}
|