|
18 | 18 | use Magento\Framework\Api\Search\SearchResultInterface;
|
19 | 19 | use Magento\Framework\Api\SearchCriteriaInterface;
|
20 | 20 | use Magento\Framework\Api\SearchResultsInterface;
|
21 |
| -use Magento\Framework\Exception\InputException; |
22 | 21 | use Magento\GraphQl\Model\Query\ContextInterface;
|
23 | 22 |
|
24 | 23 | /**
|
25 | 24 | * Product field data provider for product search, used for GraphQL resolver processing.
|
| 25 | + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) |
26 | 26 | */
|
27 | 27 | class ProductSearch
|
28 | 28 | {
|
@@ -88,7 +88,6 @@ public function __construct(
|
88 | 88 | * @param array $attributes
|
89 | 89 | * @param ContextInterface|null $context
|
90 | 90 | * @return SearchResultsInterface
|
91 |
| - * @throws InputException |
92 | 91 | */
|
93 | 92 | public function getList(
|
94 | 93 | SearchCriteriaInterface $searchCriteria,
|
@@ -148,14 +147,15 @@ private function getSearchResultsApplier(
|
148 | 147 | *
|
149 | 148 | * @param SearchCriteriaInterface $searchCriteria
|
150 | 149 | * @return array
|
151 |
| - * @throws InputException |
152 | 150 | */
|
153 | 151 | private function getSortOrderArray(SearchCriteriaInterface $searchCriteria)
|
154 | 152 | {
|
155 | 153 | $ordersArray = [];
|
156 | 154 | $sortOrders = $searchCriteria->getSortOrders();
|
157 | 155 | if (is_array($sortOrders)) {
|
158 | 156 | foreach ($sortOrders as $sortOrder) {
|
| 157 | + // I am replacing _id with entity_id because in ElasticSearch _id is required for sorting by ID. |
| 158 | + // Where as entity_id is required when using ID as the sort in $collection->load();. |
159 | 159 | if ($sortOrder->getField() === '_id') {
|
160 | 160 | $sortOrder->setField('entity_id');
|
161 | 161 | }
|
|
0 commit comments