13
13
use Magento \Elasticsearch \SearchAdapter \ConnectionManager ;
14
14
use Magento \Elasticsearch6 \Model \Client \Elasticsearch as ElasticsearchClient ;
15
15
use Magento \Framework \Exception \NoSuchEntityException ;
16
+ use Magento \Framework \Exception \StateException ;
16
17
use Magento \Framework \Search \Request \Builder ;
17
18
use Magento \Framework \Search \Request \Config as RequestConfig ;
18
19
use Magento \Framework \Search \Response \QueryResponse ;
@@ -58,6 +59,12 @@ protected function setUp()
58
59
$ this ->productRepository = $ this ->objectManager ->create (ProductRepositoryInterface::class);
59
60
}
60
61
62
+ /**
63
+ * @param string $attributeName
64
+ * @param int $searchWeight
65
+ * @throws NoSuchEntityException
66
+ * @throws StateException
67
+ */
61
68
private function setAttributeSearchWeight (string $ attributeName , int $ searchWeight )
62
69
{
63
70
/** @var AttributeRepositoryInterface $attributeRepository */
@@ -119,20 +126,20 @@ private function findProducts(string $query): array
119
126
* @magentoConfigFixture default/catalog/search/engine elasticsearch6
120
127
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
121
128
* @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
127
134
* @throws NoSuchEntityException
128
135
* @throws \Throwable
129
136
*/
130
137
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
136
143
) {
137
144
$ this ->setAttributeSearchWeight ('sku ' , $ skuSearchWeight );
138
145
$ this ->setAttributeSearchWeight ('name ' , $ nameSearchWeight );
@@ -159,7 +166,7 @@ public function testSkuOverNameAttributeSearchWeight(
159
166
);
160
167
}
161
168
162
- public function skuOverNameAttributeSearchWeightDataProvider ()
169
+ public function skuOverNameAttributeSearchWeightDataProvider (): array
163
170
{
164
171
return [
165
172
['1-2-3-4 ' , 10 , 5 , 'test ' , '1-2-3-4 ' ],
0 commit comments