mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
35 lines
658 B
PHP
35 lines
658 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
|
|
|
|
class PrefixNode extends Node
|
|
{
|
|
protected $prefix;
|
|
|
|
public function __construct($prefix)
|
|
{
|
|
$this->prefix = $prefix;
|
|
}
|
|
|
|
public function getQuery($fields = ['_all'])
|
|
{
|
|
return array(
|
|
'multi_match' => array(
|
|
'fields' => $fields,
|
|
'query' => $this->prefix,
|
|
'type' => 'phrase_prefix'
|
|
)
|
|
);
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return sprintf('prefix("%s")', $this->prefix);
|
|
}
|
|
|
|
public function isFullTextOnly()
|
|
{
|
|
return true;
|
|
}
|
|
}
|