protected function getFilterFromApiCriteria(\Magento\Framework\Api\Search\SearchCriteriaInterface $criteria)
    {
        $result = new \Flancer32\Lib\Repo\Data\ClauseSet\Filter();
        $entriesRepoTop = [];
        $groupsApi = $criteria->getFilterGroups();
        foreach ($groupsApi as $groupApi) {
            $entriesRepo = [];
            /* prevent duplications (https://github.com/magento/magento2/issues/4308) */
            $processed = [];
            /** @var \Magento\Framework\Api\Filter $item */
            foreach ($groupApi->getFilters() as $item) {
                $field = $item->getField();
                $condType = $item->getConditionType();
                $value = $item->getValue();
                $hash = "$field|$condType|$value";
                if (!isset($processed[$hash])) {
                    $condition = new \Flancer32\Lib\Repo\Data\ClauseSet\Filter\Condition();
                    $condition->alias = $field;
                    $func = $this->mapApiCondToRepoFunc($condType);
                    $condition->func = $func;
                    $condition->value = $value;
                    $entriesRepo[] = $condition;
                    $processed[$hash] = true;
                }
            }
            /* compose nested filters group */
            $groupRepo = new \Flancer32\Lib\Repo\Data\ClauseSet\Filter\Group();
            $groupRepo->entries = $entriesRepo;
            $groupRepo->with = \Flancer32\Lib\Repo\Data\ClauseSet\Filter\Group::OP_AND;
            /* and place it into the top level filter group */
            $entriesRepoTop[] = $groupRepo;
        }
        /* compose top level group for repo filter */
        $groupRepoTop = new \Flancer32\Lib\Repo\Data\ClauseSet\Filter\Group();
        $groupRepoTop->entries = $entriesRepoTop;
        $groupRepoTop->with = \Flancer32\Lib\Repo\Data\ClauseSet\Filter\Group::OP_AND;
        $result->group = $groupRepoTop;
        return $result;
    }