Skip to content

Commit cebcee2

Browse files
authored
Merge pull request #144 from apisearch-io/feature/improved-item-path-by-field
Added uuid transformation to _id
2 parents 650ca11 + 4b3f18f commit cebcee2

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Model/Item.php

+4
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,10 @@ public static function getPathByField(string $field)
675675
return $field;
676676
}
677677

678+
if ('uuid' === $field) {
679+
return '_id';
680+
}
681+
678682
if ('_id' === $field) {
679683
return $field;
680684
}

Tests/Model/ItemTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ public function testMap()
539539
public function testPathByField()
540540
{
541541
$this->assertEquals('_id', Item::getPathByField('_id'));
542+
$this->assertEquals('_id', Item::getPathByField('uuid'));
542543
$this->assertEquals('uuid.id', Item::getPathByField('id'));
543544
$this->assertEquals('uuid.type', Item::getPathByField('type'));
544545
$this->assertEquals('indexed_metadata.another_id', Item::getPathByField('another_id'));

0 commit comments

Comments
 (0)