Closed Mario8419 closed 3 years ago
hey mario, from what I understand from your description, you want the Algolia record to have the id
attribute instead of the objectID
. Algolia objectID
is required so another attribute can not take its place. If you want the id in the Algolia record, you can request a feature where the id
attribute is also added to the Algolia record. This way the objectID
and id
will be in the Algolia record.
hey smomin, thx for your quick answer. This is what I was searching for, and of course it's a feature not a bug, so sry for posting it here, but couldn't find anything dealing with the id and objectID in algolia forum. that would be what would help in my case, but I don't know how it looks with other users of this plugin!
For now I solved my use case with partialUpdateObject for my search results. but don't know whether it's such a good way...but it's working for now...
...
for (var i = 0; result.hits.length; i++) {
await searchIndex.partialUpdateObject({
id: result.hits[i].objectID,
objectID: result.hits[i].objectID
})
}
Hey @Mario8419, i have create a PR for a new feature to allow post processing. In this approach, you can add the id
property to the payload before it gets push Algolia.
When creating a firestore doc it automatically creates an id for the document as known. later on, this object is indexed by algolia with it's own prop objectID. any idea to automatically transform this objectID to id because my app is based to work with the id prop and not objectID when getting search results from algolia? this would be very useful to avoid unnecessary duplicate code in my application. thank you