mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00

- Quoted text do not hit the thesaurus anymore - getTextNodes() was misleading, renamed to getTermNodes()
35 lines
927 B
PHP
35 lines
927 B
PHP
<?php
|
|
|
|
namespace Alchemy\Phrasea\SearchEngine\Elastic\AST;
|
|
|
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\QueryContext;
|
|
use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus\Term;
|
|
use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus\TermInterface;
|
|
|
|
class TextNode extends AbstractTermNode
|
|
{
|
|
public function buildQuery(QueryContext $context)
|
|
{
|
|
$query = array(
|
|
'multi_match' => array(
|
|
'fields' => $context->getLocalizedFields(),
|
|
'query' => $this->text,
|
|
)
|
|
);
|
|
|
|
if ($conceptQueries = $this->buildConceptQueries($context)) {
|
|
$textQuery = $query;
|
|
$query = array();
|
|
$query['bool']['should'] = $conceptQueries;
|
|
$query['bool']['should'][] = $textQuery;
|
|
}
|
|
|
|
return $query;
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
return sprintf('<text:%s>', Term::dump($this));
|
|
}
|
|
}
|