Files
Phraseanet/lib/Alchemy/Phrasea/SearchEngine/Elastic/AST/QuotedTextNode.php
Mathieu Darse fe7e63b3d7 QuotedTextNode don't inherit anymore from TextNode
- Quoted text do not hit the thesaurus anymore
- getTextNodes() was misleading, renamed to getTermNodes()
2015-02-25 12:22:52 +01:00

38 lines
775 B
PHP

<?php
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
class QuotedTextNode extends Node
{
private $text;
public function __construct($text)
{
$this->text = $text;
}
public function buildQuery(QueryContext $context)
{
return array(
'multi_match' => array(
'type' => 'phrase',
'fields' => $context->getLocalizedFields(),
'query' => $this->text,
// 'operator' => 'and'
)
);
}
public function getTermNodes()
{
return array();
}
public function __toString()
{
return sprintf('<exact_text:"%s">', $this->text);
}
}