public function filterBy(
        string $filterName,
        string $field,
        array $values,
        int $applicationType = Filter::AT_LEAST_ONE,
        bool $aggregate = true,
        array $aggregationSort = Aggregation::SORT_BY_COUNT_DESC
    ): self {
        $fieldPath = Item::getPathByField($field);
        if (!empty($values)) {
            $this->filters[$filterName] = Filter::create(
                $fieldPath,
                $values,
                $applicationType,
                Filter::TYPE_FIELD
            );
        } else {
            unset($this->filters[$filterName]);
        }

        if ($aggregate) {
            $this->aggregateBy(
                $filterName,
                $field,
                $applicationType,
                $aggregationSort
            );
        }

        return $this;
    }
public function filterBy(
        string $filterName,
        string $field,
        array $values,
        int $applicationType = Filter::AT_LEAST_ONE,
        bool $aggregate = true,
        array $aggregationSort = Aggregation::SORT_BY_COUNT_DESC
    ): self {
        $fieldPath = Item::getPathByField($field);
        if (!empty($values)) {
            $this->filters[$filterName] = Filter::create(
                $fieldPath,
                $values,
                $applicationType,
                Filter::TYPE_FIELD
            );
        } else {
            unset($this->filters[$filterName]);
        }

        if ($aggregate) {
            $this->aggregateBy(
                $filterName,
                $field,
                $applicationType,
                $aggregationSort
            );
        }

        return $this;
    }
public function filterBy ( string $ filterName , string $ field , array $ values , int $ applicationType = Filter :: AT_LEAST_ONE , bool $ aggregate = true , array $ aggregationSort = Aggregation :: SORT_BY_COUNT_DESC ) : self { $ fieldPath = Item :: getPathByField ( $ field ) ; if ( ! empty ( $ values ) ) { $ this -> filters [ $ filterName ] = Filter :: create ( $ fieldPath , $ values , $ applicationType , Filter :: TYPE_FIELD ) ; } else { unset ( $ this -> filters [ $ filterName ] ) ; } if ( $ aggregate ) { $ this -> aggregateBy ( $ filterName , $ field , $ applicationType , $ aggregationSort ) ; } return $ this ; }
Filter by.

@param string $filterName
@param string $field
@param array  $values
@param int    $applicationType
@param bool   $aggregate
@param array  $aggregationSort

@return Query
Filter by .