Skip to content

Commit 44ab030

Browse files
committed
MC-16239: Search result page contain 24k results
- fix default template for mapping
1 parent 8464570 commit 44ab030

File tree

5 files changed

+66
-58
lines changed

5 files changed

+66
-58
lines changed

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,16 @@ public function addFieldsMapping(array $fields, $index, $entityType)
266266
],
267267
],
268268
],
269+
[
270+
'position_mapping' => [
271+
'match' => 'position_*',
272+
'match_mapping_type' => 'string',
273+
'mapping' => [
274+
'type' => 'integer',
275+
'index' => false,
276+
],
277+
],
278+
],
269279
[
270280
'string_mapping' => [
271281
'match' => '*',
@@ -275,16 +285,7 @@ public function addFieldsMapping(array $fields, $index, $entityType)
275285
'index' => false,
276286
]),
277287
],
278-
],
279-
[
280-
'position_mapping' => [
281-
'match' => 'position_*',
282-
'match_mapping_type' => 'string',
283-
'mapping' => [
284-
'type' => 'int',
285-
],
286-
],
287-
],
288+
]
288289
],
289290
],
290291
],

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,29 +252,31 @@ public function addFieldsMapping(array $fields, $index, $entityType)
252252
'match' => 'price_*',
253253
'match_mapping' => 'string',
254254
'mapping' => [
255-
'type' => 'float'
255+
'type' => 'float',
256+
'store' => true
256257
],
257258
],
258259
],
259260
[
260-
'string_mapping' => [
261-
'match' => '*',
261+
'position_mapping' => [
262+
'match' => 'position_*',
262263
'match_mapping' => 'string',
263264
'mapping' => [
264-
'type' => 'string',
265+
'type' => 'integer',
265266
'index' => 'no'
266267
],
267268
],
268269
],
269270
[
270-
'position_mapping' => [
271-
'match' => 'position_*',
271+
'string_mapping' => [
272+
'match' => '*',
272273
'match_mapping' => 'string',
273274
'mapping' => [
274-
'type' => 'int'
275+
'type' => 'string',
276+
'index' => 'no'
275277
],
276278
],
277-
],
279+
]
278280
],
279281
],
280282
],

app/code/Magento/Elasticsearch/Test/Unit/Elasticsearch5/Model/Client/ElasticsearchTest.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,21 +362,22 @@ public function testAddFieldsMapping()
362362
],
363363
],
364364
[
365-
'string_mapping' => [
366-
'match' => '*',
365+
'position_mapping' => [
366+
'match' => 'position_*',
367367
'match_mapping_type' => 'string',
368368
'mapping' => [
369-
'type' => 'text',
370-
'index' => false,
369+
'type' => 'integer',
370+
'index' => false
371371
],
372372
],
373373
],
374374
[
375-
'position_mapping' => [
376-
'match' => 'position_*',
375+
'string_mapping' => [
376+
'match' => '*',
377377
'match_mapping_type' => 'string',
378378
'mapping' => [
379-
'type' => 'int',
379+
'type' => 'text',
380+
'index' => false,
380381
],
381382
],
382383
],
@@ -429,24 +430,25 @@ public function testAddFieldsMappingFailure()
429430
],
430431
],
431432
[
432-
'string_mapping' => [
433-
'match' => '*',
433+
'position_mapping' => [
434+
'match' => 'position_*',
434435
'match_mapping_type' => 'string',
435436
'mapping' => [
436-
'type' => 'text',
437-
'index' => false,
437+
'type' => 'integer',
438+
'index' => false
438439
],
439440
],
440441
],
441442
[
442-
'position_mapping' => [
443-
'match' => 'position_*',
443+
'string_mapping' => [
444+
'match' => '*',
444445
'match_mapping_type' => 'string',
445446
'mapping' => [
446-
'type' => 'int',
447+
'type' => 'text',
448+
'index' => false,
447449
],
448450
],
449-
],
451+
]
450452
],
451453
],
452454
],

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,22 +262,23 @@ public function addFieldsMapping(array $fields, $index, $entityType)
262262
],
263263
],
264264
[
265-
'string_mapping' => [
266-
'match' => '*',
265+
'position_mapping' => [
266+
'match' => 'position_*',
267267
'match_mapping_type' => 'string',
268268
'mapping' => [
269-
'type' => 'text',
269+
'type' => 'integer',
270270
'index' => false,
271-
'copy_to' => '_search'
272271
],
273272
],
274273
],
275274
[
276-
'position_mapping' => [
277-
'match' => 'position_*',
275+
'string_mapping' => [
276+
'match' => '*',
278277
'match_mapping_type' => 'string',
279278
'mapping' => [
280-
'type' => 'int',
279+
'type' => 'text',
280+
'index' => false,
281+
'copy_to' => '_search'
281282
],
282283
],
283284
],

app/code/Magento/Elasticsearch6/Test/Unit/Model/Client/ElasticsearchTest.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -361,25 +361,26 @@ public function testAddFieldsMapping()
361361
],
362362
],
363363
[
364-
'string_mapping' => [
365-
'match' => '*',
364+
'position_mapping' => [
365+
'match' => 'position_*',
366366
'match_mapping_type' => 'string',
367367
'mapping' => [
368-
'type' => 'text',
369-
'index' => false,
370-
'copy_to' => '_search'
368+
'type' => 'integer',
369+
'index' => false
371370
],
372371
],
373372
],
374373
[
375-
'position_mapping' => [
376-
'match' => 'position_*',
374+
'string_mapping' => [
375+
'match' => '*',
377376
'match_mapping_type' => 'string',
378377
'mapping' => [
379-
'type' => 'int',
378+
'type' => 'text',
379+
'index' => false,
380+
'copy_to' => '_search'
380381
],
381382
],
382-
],
383+
]
383384
],
384385
],
385386
],
@@ -428,25 +429,26 @@ public function testAddFieldsMappingFailure()
428429
],
429430
],
430431
[
431-
'string_mapping' => [
432-
'match' => '*',
432+
'position_mapping' => [
433+
'match' => 'position_*',
433434
'match_mapping_type' => 'string',
434435
'mapping' => [
435-
'type' => 'text',
436-
'index' => false,
437-
'copy_to' => '_search'
436+
'type' => 'integer',
437+
'index' => false
438438
],
439439
],
440440
],
441441
[
442-
'position_mapping' => [
443-
'match' => 'position_*',
442+
'string_mapping' => [
443+
'match' => '*',
444444
'match_mapping_type' => 'string',
445445
'mapping' => [
446-
'type' => 'int',
446+
'type' => 'text',
447+
'index' => false,
448+
'copy_to' => '_search'
447449
],
448450
],
449-
],
451+
]
450452
],
451453
],
452454
],

0 commit comments

Comments
 (0)