private function joinStorePosition(\Magento\Framework\Db\Select &$select, $storeId, $useStorePositionsValue)
    {
        $useStorePositionsAttr  = $this->getUseStorePositionsAttribute();

        if ($useStorePositionsAttr && $useStorePositionsAttr->getAttributeId()) {
            $linkField = $this->getEntityMetaData(CategoryInterface::class)->getLinkField();

            $conditions    = [
                "p.category_id = use_store_positions.{$linkField}",
                "use_store_positions.store_id = " . (int) $storeId,
                "use_store_positions.attribute_id = " . (int) $useStorePositionsAttr->getAttributeId(),
            ];
            $joinCondition = new \Zend_Db_Expr(implode(" AND ", $conditions));

            $select->joinLeft(
                ['use_store_positions' => $useStorePositionsAttr->getBackendTable()],
                $joinCondition,
                []
            );

            $select->where(
                $this->getConnection()->quoteInto(
                    "COALESCE(use_store_positions.value, 0) = ?",
                    $useStorePositionsValue
                )
            );
        }
    }