Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 3511245

Browse files
committed
Migration of Elasticsearch Integration from Magento Commerce to Magento Open Source
1 parent a5cc90b commit 3511245

File tree

7 files changed

+22
-9
lines changed

7 files changed

+22
-9
lines changed

app/code/Magento/Elasticsearch/Elasticsearch5/Model/Client/Elasticsearch.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Elasticsearch\Elasticsearch5\Model\Client;
78

89
use Magento\Framework\Exception\LocalizedException;
@@ -49,7 +50,7 @@ public function __construct(
4950
if (empty($options['hostname']) || ((!empty($options['enableAuth']) &&
5051
($options['enableAuth'] == 1)) && (empty($options['username']) || empty($options['password'])))) {
5152
throw new LocalizedException(
52-
__('We were unable to perform the search because of a search engine misconfiguration.')
53+
__('The search failed because of a search engine misconfiguration.')
5354
);
5455
}
5556

app/code/Magento/Elasticsearch/Model/Adapter/Elasticsearch.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Elasticsearch\Model\Adapter;
78

89
use Magento\Framework\App\ObjectManager;
910

1011
/**
1112
* Elasticsearch adapter
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1214
*/
1315
class Elasticsearch
1416
{
@@ -110,7 +112,7 @@ public function __construct(
110112
} catch (\Exception $e) {
111113
$this->logger->critical($e);
112114
throw new \Magento\Framework\Exception\LocalizedException(
113-
__('We were unable to perform the search because of a search engine misconfiguration.')
115+
__('The search failed because of a search engine misconfiguration.')
114116
);
115117
}
116118
}

app/code/Magento/Elasticsearch/Model/Adapter/Index/IndexNameResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Elasticsearch\Model\Adapter\Index;
78

89
use Magento\Elasticsearch\Model\Client\Elasticsearch as ElasticsearchClient;
@@ -67,7 +68,7 @@ public function __construct(
6768
} catch (\Exception $e) {
6869
$this->logger->critical($e);
6970
throw new LocalizedException(
70-
__('We were unable to perform the search because of a search engine misconfiguration.')
71+
__('The search failed because of a search engine misconfiguration.')
7172
);
7273
}
7374
}

app/code/Magento/Elasticsearch/Model/Client/Elasticsearch.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Elasticsearch\Model\Client;
78

89
use Magento\Framework\Exception\LocalizedException;
@@ -44,7 +45,7 @@ public function __construct(
4445
if (empty($options['hostname']) || ((!empty($options['enableAuth']) &&
4546
($options['enableAuth'] == 1)) && (empty($options['username']) || empty($options['password'])))) {
4647
throw new LocalizedException(
47-
__('We were unable to perform the search because of a search engine misconfiguration.')
48+
__('The search failed because of a search engine misconfiguration.')
4849
);
4950
}
5051

app/code/Magento/Elasticsearch/etc/di.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,14 @@
114114
</argument>
115115
</arguments>
116116
</type>
117+
<type name="Magento\Search\Model\EngineResolver">
118+
<arguments>
119+
<argument name="engines" xsi:type="array">
120+
<item name="elasticsearch" xsi:type="string">elasticsearch</item>
121+
<item name="elasticsearch5" xsi:type="string">elasticsearch5</item>
122+
</argument>
123+
</arguments>
124+
</type>
117125
<virtualType name="Magento\Elasticsearch\SearchAdapter\ProductEntityMetadata" type="Magento\Framework\Search\EntityMetadata">
118126
<arguments>
119127
<argument name="entityId" xsi:type="string">_id</argument>

app/code/Magento/Elasticsearch/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Elasticsearch" setup_version="2.0.0">
9+
<module name="Magento_Elasticsearch">
1010
<sequence>
1111
<module name="Magento_CatalogSearch"/>
1212
<module name="Magento_Search"/>

dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Client/ElasticsearchTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function search($text)
9595
}
9696

9797
/**
98-
* @magentoConfigFixture current_store catalog/search/engine elasticsearch
98+
* @magentoConfigFixture default/catalog/search/engine elasticsearch5
9999
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
100100
*/
101101
public function testSearchConfigurableProductBySimpleProductName()
@@ -104,7 +104,7 @@ public function testSearchConfigurableProductBySimpleProductName()
104104
}
105105

106106
/**
107-
* @magentoConfigFixture current_store catalog/search/engine elasticsearch
107+
* @magentoConfigFixture default/catalog/search/engine elasticsearch
108108
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
109109
*/
110110
public function testSearchConfigurableProductBySimpleProductAttributeMultiselect()
@@ -113,7 +113,7 @@ public function testSearchConfigurableProductBySimpleProductAttributeMultiselect
113113
}
114114

115115
/**
116-
* @magentoConfigFixture current_store catalog/search/engine elasticsearch
116+
* @magentoConfigFixture default/catalog/search/engine elasticsearch
117117
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
118118
*/
119119
public function testSearchConfigurableProductBySimpleProductAttributeSelect()
@@ -122,7 +122,7 @@ public function testSearchConfigurableProductBySimpleProductAttributeSelect()
122122
}
123123

124124
/**
125-
* @magentoConfigFixture current_store catalog/search/engine elasticsearch
125+
* @magentoConfigFixture default/catalog/search/engine elasticsearch
126126
* @magentoConfigFixture current_store catalog/search/elasticsearch_index_prefix composite_product_search
127127
*/
128128
public function testSearchConfigurableProductBySimpleProductAttributeShortDescription()

0 commit comments

Comments
 (0)