mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 04:53:26 +00:00
37 lines
762 B
PHP
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.
|
|
}
|
|
}
|