File tree Expand file tree Collapse file tree 6 files changed +8
-169
lines changed
Elasticsearch/Model/Adapter
FieldMapper/Product/FieldProvider
dev/tests/integration/testsuite/Magento/CatalogSearch Expand file tree Collapse file tree 6 files changed +8
-169
lines changed Original file line number Diff line number Diff line change @@ -233,11 +233,6 @@ public function addFilters($values)
233
233
? date ('Y-m-d\TH:i:s\Z ' , strtotime ($ value ['to ' ]))
234
234
: '' ;
235
235
}
236
-
237
- if ($ attribute ->getAttributeCode () === 'sku ' ) {
238
- $ value = mb_strtolower ($ value );
239
- }
240
-
241
236
$ condition = $ this ->_getResource ()->prepareCondition (
242
237
$ attribute ,
243
238
$ value ,
Original file line number Diff line number Diff line change @@ -104,7 +104,6 @@ public function __construct(
104
104
* @param array $context
105
105
* @return array
106
106
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
107
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
108
107
*/
109
108
public function getFields (array $ context = []): array
110
109
{
@@ -121,9 +120,6 @@ public function getFields(array $context = []): array
121
120
$ allAttributes [$ fieldName ] = [
122
121
'type ' => $ this ->fieldTypeResolver ->getFieldType ($ attributeAdapter ),
123
122
];
124
- if ($ this ->isNeedToAddCustomAnalyzer ($ fieldName ) && $ this ->getCustomAnalyzer ($ fieldName )) {
125
- $ allAttributes [$ fieldName ]['analyzer ' ] = $ this ->getCustomAnalyzer ($ fieldName );
126
- }
127
123
128
124
$ index = $ this ->fieldIndexResolver ->getFieldIndex ($ attributeAdapter );
129
125
if (null !== $ index ) {
@@ -178,26 +174,4 @@ public function getFields(array $context = []): array
178
174
179
175
return $ allAttributes ;
180
176
}
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
- }
203
177
}
Original file line number Diff line number Diff line change @@ -62,14 +62,6 @@ public function build()
62
62
array_keys ($ filter )
63
63
),
64
64
'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
- ),
73
65
]
74
66
],
75
67
'tokenizer ' => $ tokenizer ,
@@ -99,11 +91,12 @@ public function setStoreId($storeId)
99
91
*/
100
92
protected function getTokenizer ()
101
93
{
102
- return [
94
+ $ tokenizer = [
103
95
'default_tokenizer ' => [
104
- 'type ' => 'standard '
105
- ]
96
+ 'type ' => 'standard ' ,
97
+ ],
106
98
];
99
+ return $ tokenizer ;
107
100
}
108
101
109
102
/**
@@ -113,13 +106,14 @@ protected function getTokenizer()
113
106
*/
114
107
protected function getFilter ()
115
108
{
116
- return [
109
+ $ filter = [
117
110
'default_stemmer ' => $ this ->getStemmerConfig (),
118
111
'unique_stem ' => [
119
112
'type ' => 'unique ' ,
120
113
'only_on_same_position ' => true
121
114
]
122
115
];
116
+ return $ filter ;
123
117
}
124
118
125
119
/**
@@ -129,11 +123,12 @@ protected function getFilter()
129
123
*/
130
124
protected function getCharFilter ()
131
125
{
132
- return [
126
+ $ charFilter = [
133
127
'default_char_filter ' => [
134
128
'type ' => 'html_strip ' ,
135
129
],
136
130
];
131
+ return $ charFilter ;
137
132
}
138
133
139
134
/**
Original file line number Diff line number Diff line change @@ -68,41 +68,6 @@ public function testExecute(array $searchParams): void
68
68
$ this ->assertContains ('Simple product name ' , $ responseBody );
69
69
}
70
70
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
-
106
71
/**
107
72
* Data provider with strings for quick search.
108
73
*
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments