diff --git a/plugins/arSolrPlugin/lib/query/arSolrBoolQuery.class.php b/plugins/arSolrPlugin/lib/query/arSolrBoolQuery.class.php index c879527e5d..3eab1e8586 100644 --- a/plugins/arSolrPlugin/lib/query/arSolrBoolQuery.class.php +++ b/plugins/arSolrPlugin/lib/query/arSolrBoolQuery.class.php @@ -220,6 +220,22 @@ public function getType() return $this->type; } + public function removeMustWithTermField($field) + { + $params = $this->getParams(); + $mustParams = []; + + foreach ($params['must'] as $query) { + if ($query instanceof arSolrTermQuery && $query->getTermField() === $field) { + continue; + } + + array_push($mustParams, $params['must']); + } + + $this->setParams('must', $mustParams); + } + protected function _addQuery(string $type, $args): self { if (!\is_array($args) && !($args instanceof arSolrAbstractQuery)) {