Skip to content

Commit 6caac74

Browse files
committed
B2B-2464: Improve category children loading
- Only fetch necessary category entity id; all other fields are unused and discarded
1 parent 07e37e3 commit 6caac74

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/code/Magento/CatalogGraphQl/Model/Category/CategoryFilter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\CatalogGraphQl\Model\Resolver\Categories\DataProvider\Category\CollectionProcessorInterface;
1515
use Magento\CatalogGraphQl\Model\Category\Filter\SearchCriteria;
1616
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
17+
use Magento\Framework\DB\Select;
1718
use Magento\Framework\Exception\InputException;
1819
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
1920
use Magento\GraphQl\Model\Query\ContextInterface;
@@ -98,6 +99,14 @@ public function getResult(array $criteria, StoreInterface $store, array $attribu
9899
/** @var CategorySearchResultsInterface $searchResult */
99100
$categories = $this->categorySearchResultsFactory->create();
100101
$categories->setSearchCriteria($searchCriteria);
102+
103+
// only fetch necessary category entity id
104+
$collection
105+
->getSelect()
106+
->reset(Select::COLUMNS)
107+
->columns(
108+
'e.entity_id'
109+
);
101110
$categories->setItems($collection->getItems());
102111
$categories->setTotalCount($collection->getSize());
103112

0 commit comments

Comments
 (0)