Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit bced14e

Browse files
authored
Merge pull request #94 from apisearch-io/fix/fixed-all-metadata-priorities
Fixed all metadata priorities
2 parents 135cdf5 + e61f616 commit bced14e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

Model/Item.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ public function addExactMatchingMetadata(
386386
public function getAllMetadata(): array
387387
{
388388
return array_merge(
389-
$this->metadata,
390-
$this->indexedMetadata
389+
$this->indexedMetadata,
390+
$this->metadata
391391
);
392392
}
393393

Tests/Model/ItemTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,22 @@ public function testIndexedMetadata()
290290
$this->assertEquals(10, $item->getIndexedMetadata()['z']);
291291
}
292292

293+
/**
294+
* Test all metadata priorities.
295+
*/
296+
public function testAllMetadataPriorities()
297+
{
298+
$item = Item::createFromArray([
299+
'uuid' => [
300+
'id' => '1',
301+
'type' => 'product',
302+
],
303+
'metadata' => ['a' => 'Hola'],
304+
'indexed_metadata' => ['a' => 'hola'],
305+
]);
306+
$this->assertEquals('Hola', $item->getAllMetadata()['a']);
307+
}
308+
293309
/**
294310
* Test item to array with default values.
295311
*/

0 commit comments

Comments
 (0)