Skip to content

Commit b801a9a

Browse files
committed
Merge remote-tracking branch 'tango/MC-36111' into PR-2020-07-22
2 parents 0f43d4c + 0c96e4d commit b801a9a

File tree

6 files changed

+8
-169
lines changed

6 files changed

+8
-169
lines changed

app/code/Magento/CatalogSearch/Model/Advanced.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ public function addFilters($values)
233233
? date('Y-m-d\TH:i:s\Z', strtotime($value['to']))
234234
: '';
235235
}
236-
237-
if ($attribute->getAttributeCode() === 'sku') {
238-
$value = mb_strtolower($value);
239-
}
240-
241236
$condition = $this->_getResource()->prepareCondition(
242237
$attribute,
243238
$value,

app/code/Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/StaticField.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public function __construct(
104104
* @param array $context
105105
* @return array
106106
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
107-
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
108107
*/
109108
public function getFields(array $context = []): array
110109
{
@@ -121,9 +120,6 @@ public function getFields(array $context = []): array
121120
$allAttributes[$fieldName] = [
122121
'type' => $this->fieldTypeResolver->getFieldType($attributeAdapter),
123122
];
124-
if ($this->isNeedToAddCustomAnalyzer($fieldName) && $this->getCustomAnalyzer($fieldName)) {
125-
$allAttributes[$fieldName]['analyzer'] = $this->getCustomAnalyzer($fieldName);
126-
}
127123

128124
$index = $this->fieldIndexResolver->getFieldIndex($attributeAdapter);
129125
if (null !== $index) {
@@ -178,26 +174,4 @@ public function getFields(array $context = []): array
178174

179175
return $allAttributes;
180176
}
181-
182-
/**
183-
* Check is the custom analyzer exists for the field
184-
*
185-
* @param string $fieldName
186-
* @return bool
187-
*/
188-
private function isNeedToAddCustomAnalyzer(string $fieldName): bool
189-
{
190-
return $fieldName === 'sku';
191-
}
192-
193-
/**
194-
* Getter for the field custom analyzer if it's exists
195-
*
196-
* @param string $fieldName
197-
* @return string|null
198-
*/
199-
private function getCustomAnalyzer(string $fieldName): ?string
200-
{
201-
return $fieldName === 'sku' ? 'sku' : null;
202-
}
203177
}

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

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ public function build()
6262
array_keys($filter)
6363
),
6464
'char_filter' => array_keys($charFilter)
65-
],
66-
'sku' => [
67-
'type' => 'custom',
68-
'tokenizer' => 'keyword',
69-
'filter' => array_merge(
70-
['lowercase', 'keyword_repeat'],
71-
array_keys($filter)
72-
),
7365
]
7466
],
7567
'tokenizer' => $tokenizer,
@@ -99,11 +91,12 @@ public function setStoreId($storeId)
9991
*/
10092
protected function getTokenizer()
10193
{
102-
return [
94+
$tokenizer = [
10395
'default_tokenizer' => [
104-
'type' => 'standard'
105-
]
96+
'type' => 'standard',
97+
],
10698
];
99+
return $tokenizer;
107100
}
108101

109102
/**
@@ -113,13 +106,14 @@ protected function getTokenizer()
113106
*/
114107
protected function getFilter()
115108
{
116-
return [
109+
$filter = [
117110
'default_stemmer' => $this->getStemmerConfig(),
118111
'unique_stem' => [
119112
'type' => 'unique',
120113
'only_on_same_position' => true
121114
]
122115
];
116+
return $filter;
123117
}
124118

125119
/**
@@ -129,11 +123,12 @@ protected function getFilter()
129123
*/
130124
protected function getCharFilter()
131125
{
132-
return [
126+
$charFilter = [
133127
'default_char_filter' => [
134128
'type' => 'html_strip',
135129
],
136130
];
131+
return $charFilter;
137132
}
138133

139134
/**

dev/tests/integration/testsuite/Magento/CatalogSearch/Controller/Advanced/ResultTest.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,6 @@ public function testExecute(array $searchParams): void
6868
$this->assertContains('Simple product name', $responseBody);
6969
}
7070

71-
/**
72-
* Advanced search test by difference product attributes.
73-
*
74-
* @magentoConfigFixture default/catalog/search/engine elasticsearch6
75-
* @magentoAppArea frontend
76-
* @magentoDataFixture Magento/CatalogSearch/_files/product_for_search_with_hyphen_in_sku.php
77-
* @magentoDataFixture Magento/CatalogSearch/_files/full_reindex.php
78-
*
79-
* @return void
80-
*/
81-
public function testExecuteSkuWithHyphen(): void
82-
{
83-
$this->getRequest()->setQuery(
84-
$this->_objectManager->create(
85-
Parameters::class,
86-
[
87-
'values' => [
88-
'name' => '',
89-
'sku' => '24-mb01',
90-
'description' => '',
91-
'short_description' => '',
92-
'price' => [
93-
'from' => '',
94-
'to' => '',
95-
],
96-
'test_searchable_attribute' => '',
97-
]
98-
]
99-
)
100-
);
101-
$this->dispatch('catalogsearch/advanced/result');
102-
$responseBody = $this->getResponse()->getBody();
103-
$this->assertContains('Simple product name', $responseBody);
104-
}
105-
10671
/**
10772
* Data provider with strings for quick search.
10873
*

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_with_hyphen_in_sku.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/CatalogSearch/_files/product_for_search_with_hyphen_in_sku_rollback.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)