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

Search#query property is not modified anymore after execution

parent 36864231
No related branches found
No related tags found
No related merge requests found
......@@ -549,7 +549,7 @@ class Search
*/
public function getQueries()
{
return $this->queries;
return $this->query;
}
/**
......@@ -623,26 +623,22 @@ class Search
{
$output = [];
if ($this->filters !== null) {
if ($this->query === null) {
$queryForFiltered = null;
} else {
$queryForFiltered = clone $this->query;
}
$query = $this->query;
$filteredQuery = new FilteredQuery($queryForFiltered);
if ($this->filters !== null) {
$filteredQuery = new FilteredQuery($query === null ? null : $query);
$filteredQuery->setFilter($this->filters);
if ($this->boolFilterParams) {
$filteredQuery->setBoolParameters($this->boolFilterParams);
}
$this->destroyQuery();
$this->addQuery($filteredQuery);
$query = new Query();
$query->addQuery($filteredQuery);
}
if ($this->query !== null) {
$output[$this->query->getType()] = $this->query->toArray();
if ($query !== null) {
$output[$query->getType()] = $query->toArray();
}
if ($this->postFilters !== null) {
......
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