Files
Phraseanet/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/TextNode.php
2014-11-06 19:11:06 +01:00

39 lines
656 B
PHP

<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
class TextNode extends Node
{
protected $text;
public function __construct($text)
{
$this->text = $text;
}
public function getQuery($fields = ['_all'])
{
return array(
'multi_match' => array(
'fields' => $fields,
'query' => $this->text,
)
);
}
public function __toString()
{
return sprintf('"%s"', $this->text);
}
public function isFullTextOnly()
{
return true;
}
public function getText()
{
return $this->text;
}
}