Skip to content

Commit cc671eb

Browse files
author
Roman Lytvynenko
committed
MAGETWO-99769: SKU search weight is ignored
1 parent f328617 commit cc671eb

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Search/AttributeSearchWeightTest.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Elasticsearch\SearchAdapter\ConnectionManager;
1414
use Magento\Elasticsearch6\Model\Client\Elasticsearch as ElasticsearchClient;
1515
use Magento\Framework\Exception\NoSuchEntityException;
16+
use Magento\Framework\Exception\StateException;
1617
use Magento\Framework\Search\Request\Builder;
1718
use Magento\Framework\Search\Request\Config as RequestConfig;
1819
use Magento\Framework\Search\Response\QueryResponse;
@@ -58,6 +59,12 @@ protected function setUp()
5859
$this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
5960
}
6061

62+
/**
63+
* @param string $attributeName
64+
* @param int $searchWeight
65+
* @throws NoSuchEntityException
66+
* @throws StateException
67+
*/
6168
private function setAttributeSearchWeight(string $attributeName, int $searchWeight)
6269
{
6370
/** @var AttributeRepositoryInterface $attributeRepository */
@@ -119,20 +126,20 @@ private function findProducts(string $query): array
119126
* @magentoConfigFixture default/catalog/search/engine elasticsearch6
120127
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
121128
* @magentoDataFixture Magento/CatalogSearch/_files/products_for_sku_search_weight_score.php
122-
* @param $searchQuery
123-
* @param $skuSearchWeight
124-
* @param $nameSearchWeight
125-
* @param $firstMatchProductName
126-
* @param $secondMatchProductName
129+
* @param string $searchQuery
130+
* @param int $skuSearchWeight
131+
* @param int $nameSearchWeight
132+
* @param string $firstMatchProductName
133+
* @param string $secondMatchProductName
127134
* @throws NoSuchEntityException
128135
* @throws \Throwable
129136
*/
130137
public function testSkuOverNameAttributeSearchWeight(
131-
$searchQuery,
132-
$skuSearchWeight,
133-
$nameSearchWeight,
134-
$firstMatchProductName,
135-
$secondMatchProductName
138+
string $searchQuery,
139+
int $skuSearchWeight,
140+
int $nameSearchWeight,
141+
string $firstMatchProductName,
142+
string $secondMatchProductName
136143
) {
137144
$this->setAttributeSearchWeight('sku', $skuSearchWeight);
138145
$this->setAttributeSearchWeight('name', $nameSearchWeight);
@@ -159,7 +166,7 @@ public function testSkuOverNameAttributeSearchWeight(
159166
);
160167
}
161168

162-
public function skuOverNameAttributeSearchWeightDataProvider()
169+
public function skuOverNameAttributeSearchWeightDataProvider(): array
163170
{
164171
return [
165172
['1-2-3-4', 10, 5, 'test', '1-2-3-4'],

0 commit comments

Comments
 (0)