Skip to content
Snippets Groups Projects
Commit 5ea69c0b authored by Martynas Sudintas's avatar Martynas Sudintas
Browse files

do not set filtered query into query endpoint during normalization

parent 1a38c056
No related branches found
No related tags found
No related merge requests found
...@@ -40,20 +40,24 @@ class QueryEndpoint extends AbstractSearchEndpoint implements OrderedNormalizerI ...@@ -40,20 +40,24 @@ class QueryEndpoint extends AbstractSearchEndpoint implements OrderedNormalizerI
*/ */
public function normalize(NormalizerInterface $normalizer, $format = null, array $context = []) public function normalize(NormalizerInterface $normalizer, $format = null, array $context = [])
{ {
$query = $this->getBool();
if ($this->hasReference('filtered_query')) { if ($this->hasReference('filtered_query')) {
/** @var FilteredQuery $filteredQuery */ /** @var FilteredQuery $filteredQuery */
$filteredQuery = $this->getReference('filtered_query'); $filteredQuery = $this->getReference('filtered_query');
$this->add($filteredQuery);
if ($query) {
$filteredQuery->setQuery($query);
}
$query = $filteredQuery;
} }
if (!$this->bool) { if (!$query) {
return null; return null;
} }
$queryArray = $this->bool->toArray(); return [$query->getType() => $query->toArray()];
$queryArray = [$this->bool->getType() => $queryArray];
return $queryArray;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment