text = $text; } public function setConcepts(array $concepts) { $this->concepts = $concepts; } public function buildQuery(QueryContext $context) { $query = array( 'multi_match' => array( 'fields' => $context->getLocalizedFields(), 'query' => $this->text, ) ); if ($this->concepts) { $shoulds = array($query); foreach ($this->concepts as $concept) { $shoulds[]['term']['concept_paths'] = $concept->getPath(); } $query = array(); $query['bool']['should'] = $shoulds; } return $query; } public function getTextNodes() { return array($this); } public function __toString() { return sprintf('"%s"', $this->text); } // Implementation of TermInterface public function getValue() { return $this->text; } public function hasContext() { return false; } public function getContext() { // TODO Insert context during parsing return null; } }