Skip to content

Commit a46f945

Browse files
committed
MC-32378: Implement control over minimum_should_match for elasticsearch queries
1 parent d6d666b commit a46f945

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

app/code/Magento/Elasticsearch7/etc/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<elasticsearch7_index_prefix>magento2</elasticsearch7_index_prefix>
1515
<elasticsearch7_enable_auth>0</elasticsearch7_enable_auth>
1616
<elasticsearch7_server_timeout>15</elasticsearch7_server_timeout>
17-
<elasticsearch7_minimum_should_match></elasticsearch7_minimum_should_match>
17+
<elasticsearch7_minimum_should_match/>
1818
</search>
1919
</catalog>
2020
</default>

dev/tests/integration/testsuite/Magento/Elasticsearch/_files/products_for_search.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,81 +12,81 @@
1212
use Magento\Catalog\Model\Product\Attribute\Source\Status;
1313
use Magento\Catalog\Model\Product\Visibility;
1414

15+
$categoryId = 333;
16+
$objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
17+
$attributeSet = $objectManager->create(\Magento\Eav\Model\Entity\Attribute\Set::class);
18+
$entityType = $objectManager->create(\Magento\Eav\Model\Entity\Type::class)->loadByCode('catalog_product');
19+
$defaultSetId = $objectManager->create(\Magento\Catalog\Model\Product::class)->getDefaultAttributeSetid();
20+
1521
$products = [
1622
[
1723
'type' => 'simple',
18-
'id' => 201,
1924
'name' => 'search product 1',
2025
'sku' => '24 MB06',
2126
'status' => Status::STATUS_ENABLED,
2227
'visibility' => Visibility::VISIBILITY_BOTH,
23-
'attribute_set' => 4,
24-
'website_ids' => [1],
28+
'attribute_set' => $defaultSetId,
29+
'website_ids' => [\Magento\Store\Model\Store::DISTRO_STORE_ID],
2530
'price' => 10,
26-
'category_id' => 333,
31+
'category_id' => $categoryId,
2732
'meta_title' => 'Key Title',
2833
'meta_keyword' => 'meta keyword',
2934
'meta_description' => 'meta description',
3035
],
3136
[
3237
'type' => 'simple',
33-
'id' => 202,
3438
'name' => 'search product 2',
3539
'sku' => '24 MB04',
3640
'status' => Status::STATUS_ENABLED,
3741
'visibility' => Visibility::VISIBILITY_BOTH,
38-
'attribute_set' => 4,
39-
'website_ids' => [1],
42+
'attribute_set' => $defaultSetId,
43+
'website_ids' => [\Magento\Store\Model\Store::DISTRO_STORE_ID],
4044
'price' => 10,
41-
'category_id' => 333,
45+
'category_id' => $categoryId,
4246
'meta_title' => 'Last Title',
4347
'meta_keyword' => 'meta keyword',
4448
'meta_description' => 'meta description',
4549
],
4650
[
4751
'type' => 'simple',
48-
'id' => 203,
4952
'name' => 'search product 3',
5053
'sku' => '24 MB02',
5154
'status' => Status::STATUS_ENABLED,
5255
'visibility' => Visibility::VISIBILITY_BOTH,
53-
'attribute_set' => 4,
54-
'website_ids' => [1],
56+
'attribute_set' => $defaultSetId,
57+
'website_ids' => [\Magento\Store\Model\Store::DISTRO_STORE_ID],
5558
'price' => 20,
56-
'category_id' => 333,
59+
'category_id' => $categoryId,
5760
'meta_title' => 'First Title',
5861
'meta_keyword' => 'meta keyword',
5962
'meta_description' => 'meta description',
6063
],
6164
[
6265
'type' => 'simple',
63-
'id' => 204,
6466
'name' => 'search product 4',
6567
'sku' => '24 MB01',
6668
'status' => Status::STATUS_ENABLED,
6769
'visibility' => Visibility::VISIBILITY_BOTH,
68-
'attribute_set' => 4,
69-
'website_ids' => [1],
70+
'attribute_set' => $defaultSetId,
71+
'website_ids' => [\Magento\Store\Model\Store::DISTRO_STORE_ID],
7072
'price' => 30,
71-
'category_id' => 333,
73+
'category_id' => $categoryId,
7274
'meta_title' => 'A title',
7375
'meta_keyword' => 'meta keyword',
7476
'meta_description' => 'meta description',
7577
],
7678
];
7779

7880
/** @var CategoryLinkManagementInterface $categoryLinkManagement */
79-
$categoryLinkManagement = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()
80-
->create(CategoryLinkManagementInterface::class);
81+
$categoryLinkManagement = $objectManager->create(CategoryLinkManagementInterface::class);
8182

8283
$categoriesToAssign = [];
8384

8485
foreach ($products as $data) {
8586
/** @var $product Product */
86-
$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(Product::class);
87+
$product = $objectManager->create(Product::class);
8788
$product
8889
->setTypeId($data['type'])
89-
->setId($data['id'])
9090
->setAttributeSetId($data['attribute_set'])
9191
->setWebsiteIds($data['website_ids'])
9292
->setName($data['name'])

dev/tests/integration/testsuite/Magento/Elasticsearch/_files/products_for_search_rollback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
}
3232

33-
include dirname(dirname(__DIR__)) . '/Catalog/_files/category_rollback.php';
33+
include __DIR__ . '/../../Catalog/_files/category_rollback.php';
3434

3535
$registry->unregister('isSecureArea');
3636
$registry->register('isSecureArea', false);

0 commit comments

Comments
 (0)