Files
Phraseanet/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/PrefixNode.php
2015-11-04 16:31:34 +01:00

37 lines
762 B
PHP

<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
class PrefixNode extends Node
{
protected $prefix;
public function __construct($prefix)
{
$this->prefix = $prefix;
}
public function buildQuery(QueryContext $context)
{
return [
'multi_match' => [
'fields' => $context->getLocalizedFields(),
'query' => $this->prefix,
'type' => 'phrase_prefix'
]
];
}
public function __toString()
{
return sprintf('prefix("%s")', $this->prefix);
}
public function getTermNodes()
{
// TODO: Implement getTermNodes() method.
}
}