return the query restriction for active filter. returns false if there
is no active restriction for this item.

@return string
323603
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = $this->GetFromInternalCache('sQueryRestrictionForActiveFilter');
        if (null === $sQuery) {
            $databaseConnection = $this->getDatabaseConnection();
            $aValues = $this->aActiveFilterData;
            if (is_array($aValues) && count($aValues) > 0) {
                $sItemListQuery = $this->GetSQLQueryForQueryRestrictionForActiveFilter();
                $aIdList = array();
                if (!empty($sItemListQuery)) {
                    $tRes = MySqlLegacySupport::getInstance()->query($sItemListQuery);
                    $aIdList = array();
                    while ($aItemRow = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                        $aIdList[] = $databaseConnection->quote($aItemRow['source_id']);
                    }
                }

                if (count($aIdList) > 0) {
                    if (defined(
                            'PKG_SHOP_LISTFILTER_ATTRIBUTE_FILTER_SELECT_VARIANTS'
                        ) && PKG_SHOP_LISTFILTER_ATTRIBUTE_FILTER_SELECT_VARIANTS
                    ) {
                        //now we have a list of variant article ids but we need parent ids so we fetch the parent id for each variant id without duplicates
                        $sParentQuery = 'SELECT `shop_article`.`variant_parent_id`
                                 FROM `shop_article`
                                WHERE `shop_article`.`id` IN ('.implode(',', $aIdList).")
                                AND `shop_article`.`variant_parent_id` != '' ";
                        $rResult = MySqlLegacySupport::getInstance()->query($sParentQuery);
                        $aIdList = array();

                        while ($aRow = MySqlLegacySupport::getInstance()->fetch_assoc($rResult)) {
                            if (!in_array($aRow['variant_parent_id'], $aIdList)) {
                                $aIdList[] = $databaseConnection->quote($aRow['variant_parent_id']);
                            }
                        }
                    }

                    $sQuery = '`shop_article`.`id` IN ('.implode(',', $aIdList).')';
                }
            }
            $this->SetInternalCache('sQueryRestrictionForActiveFilter', $sQuery);
        }

        return $sQuery;
    }
838452
public function getSearchRules()
    {
        return isset($this->searchRules) && count($this->searchRules) > 0 ?
            $this->searchRules : [SearchRule::class];
    }
1232878
public function GetActiveValue()
    {
        $iValue = $this->aActiveFilterData;
        if (is_null($iValue) || ('0' != $iValue && '1' != $iValue)) {
            $iValue = '';
        }

        return $iValue;
    }
1123190
public function get_restriction($key = 0)
	{
		$restrictions = $this->get_restrictions();
		if (isset($restrictions[$key]))
		{
			return $restrictions[$key];
		}

		return null;
	}
804888
public function GetSearchRestrictionLink()
    {
        // get current search... then add filter
        $oShop = $this->getShopService()->getActiveShop();
        $oSearchCache = &$oShop->GetActiveSearchObject();
        //$oSearchCache->aFilter[TdbShopCategory::FILTER_KEY_NAME] = $this->id;
        return $oSearchCache->GetSearchLink(array(TdbShopCategory::FILTER_KEY_NAME => $this->id));
    }
64962
public function getSearchQuery()
    {
        $query      = null;
        $conditions = $this->getConditions();

        if ($conditions) {
            $query = $conditions->getSearchQuery();
        }

        return $query;
    }
1106068
public function getFilterPreselect()
    {
        // get definitions from plugin settings
        // and proceed only when preselectedFilter was not set
        // this reduces the amount of sql queries, too
        if ($this->conf['preselected_filters'] && count($this->preselectedFilter) == 0) {
            $preselectedArray = GeneralUtility::trimExplode(',', $this->conf['preselected_filters'], true);
            foreach ($preselectedArray as $option) {
                $option = intval($option);
                $queryBuilder = Db::getQueryBuilder('tx_kesearch_filters');
                $pageRepository = GeneralUtility::makeInstance(PageRepository::class);
                $filterRows = $queryBuilder
                    ->add(
                        'select',
                        '`tx_kesearch_filters`.`uid` AS filteruid, `tx_kesearch_filteroptions`.`uid` AS optionuid, `tx_kesearch_filteroptions`.`tag`'
                    )
                    ->from('tx_kesearch_filters')
                    ->from('tx_kesearch_filteroptions')
                    ->add(
                        'where',
                        'FIND_IN_SET("' . $option . '",tx_kesearch_filters.options)'
                        . ' AND `tx_kesearch_filteroptions`.`uid` = ' . $option
                        . $pageRepository->enableFields('tx_kesearch_filters')
                        . $pageRepository->enableFields('tx_kesearch_filteroptions')
                    )
                    ->execute()
                    ->fetchAll();

                foreach ($filterRows as $row) {
                    $this->preselectedFilter[$row['filteruid']][$row['optionuid']] = $row['tag'];
                }
            }
        }
    }
1324115
public function getQuery()
    {
        $queryParts = array_map(function ($value) {
            return ($value instanceof Operator) ? $value->expression() : $value;
        }, $this->queryParts);

        return implode('', $queryParts);
    }
1270385
public function activeFilterAttributes()
    {
        $scenario = $this->getScenario();
        $scenarios = $this->filteringScenarios();

        $attributes = isset($scenarios[$scenario]) ? $scenarios[$scenario] : $scenarios[ActiveRecord::SCENARIO_DEFAULT];
        foreach ($attributes as $i => $attribute) {
            if ($attribute[0] === '!') {
                $attributes[$i] = substr($attribute, 1);
            }
        }

        return $attributes;
    }
728951
public function getQuery()
    {
        $query = parent::getQuery();
        if ( $this->hasLimit )
        {
            $max = $this->offset + $this->limit;
            if ( $this->offset > 0 ) 
            {
                $min = $this->offset + 1;
                $query = "SELECT * FROM (SELECT a.*, ROWNUM rn FROM ( {$query} ) a WHERE rownum <= {$max} ) WHERE rn >= {$min}";
            }
            else 
            {
                $query = "SELECT a.* FROM ( {$query} ) a WHERE ROWNUM <= {$max}";
            }            
        }
        return $query;
    }
98763
public function getQuery()
    {
        $query = $this->database->getSelectQuery()->from($this->table);

        foreach ($this->join as $join) {
            if (!is_array($join[2])) {
                $join[2] = [$join[2]];
            }

            $where = array_shift($join[2]);
            if (!empty($join[2])) {
                foreach ($join[2] as $i => $value) {
                    $join[2][$i] = $this->database->bind($value);
                }

                $where = vsprintf($where, $join[2]);
            }

            $query->join($join[0], $join[1], $where, $join[3]);
        }

        foreach ($this->filter as $i => $filter) {
            //array('post_id=%s AND post_title IN %s', 123, array('asd'));
            $where = array_shift($filter);
            if (!empty($filter)) {
                foreach ($filter as $i => $value) {
                    $filter[$i] = $this->database->bind($value);
                }

                $where = vsprintf($where, $filter);
            }

            $query->where($where);
        }

        return $query;
    }
737606
public function getFilter()
    {
        $filter = [];
        $tag = $this->getRequest()->getVar("t");

        if ($tag) {
            $filter["Tags.URLSegment"] = $tag;
        }

        $this->extend("updateFilter", $filter);

        return $filter;
    }
562441
public function getFilterQuery(array $default = array(), $allowed = array())
    {
        $query = $this->query;
        foreach ($query as $key => $value) {

            if (!is_string($value)) {
                continue;
            }

            if ($key === 'sort' && strpos($value, '-') !== false) {
                list($sort, $order) = explode('-', $value, 2);
                $query['sort'] = $sort;
                $query['order'] = $order;
            }

            if ($value === 'any') {
                unset($query[$key]);
            }
        }

        $query += $default;

        if (empty($allowed)) {
            return $query;
        }

        return array_intersect_key($query, array_flip($allowed));
    }
506391
protected function checkRequestFilters()
	{
		$filterName = Yii::app()->getRequest()->getParam($this->saveFilterVar);
		if (!$filterName)
			return false;

		if (!count($this->filteredBy))
			return false;

		$key = $this->generateRegistryItemKey();
		if ($this->jsonStorage->getData($key, $this->registry))
			return false;

		$data = array('name' => $filterName);
		$data['options'] = array(get_class($this->model) => $this->filteredBy);
		$this->jsonStorage->setData($key, $data, $this->registry);

		Yii::app()->getController()->redirect($this->redirectRoute);
		return true;
	}
1279825
public function getFiltering()
    {
        if ($this->filtering === null) {
            $this->filtering = new Filtering($this);
        }
        return $this->filtering;
    }
1298094
public function isIdInPostAllowed()
    {
        $isAllowed = true;
        if (isset($this->schema->{'x-id-in-post-allowed'})) {
            $isAllowed = $this->schema->{'x-id-in-post-allowed'};
        }
        return $isAllowed;
    }
550209
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = $this->GetFromInternalCache('sQueryRestrictionForActiveFilter');
        if (is_null($sQuery)) {
            $aValues = $this->aActiveFilterData;
            if (is_array($aValues) && count($aValues) > 0) {
                $aValues = TTools::MysqlRealEscapeArray($aValues);
                $sItemListQuery = 'SELECT * FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->sItemTableName).'` WHERE '.$this->GetTargetTableNameField()." IN ('".implode("','", $aValues)."')";
                $tRes = MySqlLegacySupport::getInstance()->query($sItemListQuery);
                $aIdList = array();
                while ($aItemRow = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                    $aIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($aItemRow['id']);
                }

                if (count($aIdList) > 0) {
                    $sQuery = '`shop_article`.`'.MySqlLegacySupport::getInstance()->real_escape_string($this->sItemFieldName)."` IN ('".implode("','", $aIdList)."')";
                }
            }
            $this->SetInternalCache('sQueryRestrictionForActiveFilter', $sQuery);
        }

        return $sQuery;
    }