Remove filter from query.

@param Result $result
@param string $filterName
@param string $value

@return string
486209
public function removeFilterValue(
        Result $result,
        string $filterName,
        string $value = null
    ): string {
        $urlParameters = $this->generateQueryUrlParameters($result);

        if (
            is_null($value) ||
            !isset($urlParameters[$filterName])
        ) {
            unset($urlParameters[$filterName]);
        } elseif (false !== ($key = array_search($value, $urlParameters[$filterName]))) {
            unset($urlParameters[$filterName][$key]);
        }

        return $this->createUrlByUrlParameters(
            $result,
            $urlParameters
        )['route'];
    }
1310523
protected function getResultVariables($resultId, $filterSubmission, $filterTypes = array())
    {
        $resultService = $this->getResultsService();
        $variables = $resultService->getStructuredVariables($resultId, $filterSubmission, array_merge($filterTypes, [\taoResultServer_models_classes_ResponseVariable::class]));
        $displayedVariables = $resultService->filterStructuredVariables($variables, $filterTypes);
        $responses = ResponseVariableFormatter::formatStructuredVariablesToItemState($variables);
        $excludedVariables = array_flip(['numAttempts', 'duration']);

        foreach ($displayedVariables as &$item) {
            if (!isset($item['uri'])) {
                continue;
            }
            $itemUri = $item['uri'];
            $item['state'] = isset($responses[$itemUri][$item['attempt']])
                ? json_encode(array_diff_key($responses[$itemUri][$item['attempt']], $excludedVariables))
                : null;
        }

        return $displayedVariables;
    }
243572
protected function applyFilter($name, $value, $options = [])
    {
        $this->hasFilter($name);

        if (empty($value)) return $value;

        $filter = $this->filters[$name];

        if ($filter instanceof Closure) {
            return call_user_func_array($filter, compact('value', 'options'));
        }

        /** @var Filterable $filterable */
        $filterable = new $filter;

        return $filterable->filter($value, $options);
    }
760463
public void remove(String txn) {
        synchronized (filterMap) {
            // Check if old filter processor needs to be removed
            FilterProcessor oldfp = filterMap.get(txn);
            if (oldfp != null) {
                globalExclusionFilters.remove(oldfp);
                btxnFilters.remove(oldfp);
            }
        }
    }
1206143
function remove($selector, $callbackOrName = true)
    {
        if (array_key_exists($selector, $this->filters)) {
            if ($callbackOrName === true) {
                unset($this->filters[$selector]);
            } else {
                if (! is_object($callbackOrName)) {
                    $filter = $this->filterFactory->createFilter($callbackOrName);
                } else {
                    $filter = $callbackOrName;
                }
                /* @var $filterSet FilterSet */
                $filterSet = $this->filters[$selector];
                $filterSet->remove($filter);
            }
        }
        return $this;
    }
961938
public function removeFilter($name)
    {
        $filters = $this->config('filters');
        unset($filters[$name]);

        $this->config('filters', $filters, false);
    }
362000
protected function filterValue($value)
    {
        $filter = new Filter();

        call_user_func($this->callable, $filter);

        return $filter->filter($value);
    }
481795
protected function getFilterFields(&$result) {
        if(!empty($this->_filter)) {
            foreach ($this->_filter as $field=>$filter){
                if(isset($result[$field])) {
                    $fun  =  $filter[1];
                    if(!empty($fun)) {
                        if(isset($filter[2]) && $filter[2]){
                            // 传递整个数据对象作为参数
                            $result[$field]  =  call_user_func($fun,$result);
                        }else{
                            // 传递字段的值作为参数
                            $result[$field]  =  call_user_func($fun,$result[$field]);
                        }
                    }
                }
            }
        }
        return $result;
    }
245476
protected function valueMatchesFilter($value, IndexQueryFilter $filter): bool
    {
        switch ($filter->getOperator()) {
            case IndexQueryFilterOperator::EQUAL_TO:
                return $value == $filter->getValue();

            case IndexQueryFilterOperator::NOT_EQUAL_TO:
                return $value != $filter->getValue();

            case IndexQueryFilterOperator::GREATER_THAN:
                return $value > $filter->getValue();

            case IndexQueryFilterOperator::GREATER_THAN_OR_EQUAL_TO:
                return $value >= $filter->getValue();

            case IndexQueryFilterOperator::LESS_THAN:
                return $value < $filter->getValue();

            case IndexQueryFilterOperator::LESS_THAN_OR_EQUAL_TO:
                return $value <= $filter->getValue();
        }
    }
1219614
private function generateQueryUrlParameters(
        Result $result,
        string $filterName = null
    ): array {
        $query = $result->getQuery();
        $queryFilters = $query->getFilters();
        $urlParameters = [];
        foreach ($queryFilters as $currentFilterName => $filter) {
            /*
             * Special case for elements with LEVEL.
             */
            $urlParameters[$currentFilterName] = (
                !is_null($filterName) &&
                $currentFilterName === $filterName &&
                Filter::MUST_ALL_WITH_LEVELS === $filter->getApplicationType()
            )
                ? []
                : $filter->getValues();
        }

        unset($urlParameters['_query']);

        $queryFilter = $query->getFilter('_query');
        $queryString = $queryFilter instanceof Filter
            ? $queryFilter->getValues()[0]
            : '';

        if (!empty($queryString)) {
            $urlParameters['q'] = $queryString;
        }

        $sort = $query->getSortBy();
        if (SortBy::SCORE !== $sort) {
            $urlParameters['sort_by'] = $sort;
        }

        return $urlParameters;
    }
203296
public function filterValues($name, $value)
    {
        return $this->filter(function (EntityInterface $entity) use ($name, $value) {
            return $entity->getByName($name) === $value;
        });
    }
701890
private function applyInputFilters($value, $filters)
    {
        foreach ($filters as $filter) {
            if (is_string($filter) && isset(self::$filterCallbacks[$filter])) {
                $value = call_user_func(self::$filterCallbacks[$filter], $value);
            }
        }
        return $value;
    }
1220649
protected function filterWouldMatch($filterValue, $value, $key)
    {
        if ($value === null) {
            return $filterValue === null;
        }

        if (is_array($filterValue)) {
            return is_array($value) ? $filterValue == $value : in_array($value, $filterValue);
        }

        if (is_numeric($value)) {
            return $filterValue == $value;
        }

        return mb_strpos($value, $filterValue) !== false;

    }
959327
final public function remove($elementName, $return = false) {
        if (isset($this->elements[$elementName])) {
            if ($return)
                $return = $this->elements[$elementName];
            $this->ignoreFilter($elementName);
            unset($this->elements[$elementName]);
            $elementName = str_replace('[]', '', $elementName);
            unset($this->elements[$elementName]);
            unset($this->data[$elementName]);
        }

        return $return ? $return : $this;
    }
330933
public static function common(string $filter, ...$value)
	{
		if (method_exists(__CLASS__, $filter)) {
			return self::$filter(...$value);
		}
		return null;
	}
200905
private function filterValue(&$value, $key, $filters)
    {
        $default = array_pop($filters);
        foreach ($filters as $filter) {
            if (is_callable($filter)) {
                // 调用函数或者方法过滤
                $value = call_user_func($filter, $value);
            } elseif (is_scalar($value)) {
                if (strpos($filter, '/')) {
                    // 正则过滤
                    if (!preg_match($filter, $value)) {
                        // 匹配不成功返回默认值
                        $value = $default;
                        break;
                    }
                } elseif (!empty($filter)) {
                    // filter函数不存在时, 则使用filter_var进行过滤
                    // filter为非整形值时, 调用filter_id取得过滤id
                    $value = filter_var($value, is_int($filter) ? $filter : filter_id($filter));
                    if (false === $value) {
                        $value = $default;
                        break;
                    }
                }
            }
        }
        return $this->filterExp($value);
    }
1306564
private function getPageFilter($filterName, $storeId = null)
    {
        $pageFilters = $this->getPageFilters($storeId);
        if ($pageFilters && @$pageFilters->$filterName) {
            return (array)$pageFilters->$filterName;
        }
        return [];
    }