Skip to content

Commit 3a8efd3

Browse files
author
Julien Colinet
committed
Compatibility remove index with Uuid / Ulid
This does not work correctly with a UUID or ULID object as the primary key. To index a document, no problem, Meilisearch does convert the ObjectId into a character string. On the other hand, to delete a resource from MeiliSearch, you must indicate the ObjectId in character string in the url of the DELETE request. While waiting for the refactoring on the objectID which will surely correct this bug (# 58). My fix while waiting for the refacto of the objectId and indicating the ObjectID property of the normalized object instead of entity-> getID (). For those who use an objectID as a string, this does not change anything. For those like me who use a UUID or ULID, putting $ searchableArray ['id'] in place of $ entity-> getID () allows to retrieve the uuid or the ulid as a string.
1 parent 4657401 commit 3a8efd3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Engine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function remove($searchableEntities): array
8585
$data[$indexUid] = [];
8686
}
8787

88-
$data[$indexUid][] = $entity->getId();
88+
$data[$indexUid][] = $searchableArray['id'];
8989
}
9090

9191
$result = [];

0 commit comments

Comments
 (0)