Skip to content

Commit 17a9dd3

Browse files
committed
Merge remote-tracking branch 'origin/AC-14835' into spartans_pr_27102025
2 parents 463f3ff + 70ac0c4 commit 17a9dd3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

app/code/Magento/Elasticsearch/SearchAdapter/Query/Builder/Sort/Position.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ public function build(AttributeAdapter $attribute, string $direction, RequestInt
6969
$fieldName = $this->fieldNameResolver->getFieldName($attribute);
7070
}
7171

72+
if ($fieldName !== '_script') {
73+
$sortParams['unmapped_type'] = 'integer';
74+
}
75+
7276
return [$fieldName => $sortParams];
7377
}
7478

app/code/Magento/Elasticsearch/Test/Unit/SearchAdapter/Query/Builder/Sort/PositionTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ public function testBuildWithoutCategoryIds(): void
6060
->willReturn('position_category_2');
6161

6262
$result = $this->position->build($attributeMock, 'desc', $requestMock);
63-
self::assertEquals(['position_category_2' => ['order' => 'desc']], $result);
63+
self::assertEquals(
64+
['position_category_2' => ['order' => 'desc', 'unmapped_type' => 'integer']],
65+
$result
66+
);
6467
}
6568

6669
/**
@@ -90,7 +93,10 @@ public function testBuildWithSingleCategoryId(): void
9093
->willReturn('position_category_5');
9194

9295
$result = $this->position->build($attributeMock, 'desc', $requestMock);
93-
self::assertEquals(['position_category_5' => ['order' => 'desc']], $result);
96+
self::assertEquals(
97+
['position_category_5' => ['order' => 'desc', 'unmapped_type' => 'integer']],
98+
$result
99+
);
94100
}
95101

96102
/**

0 commit comments

Comments
 (0)