So my goal is to be able to update a piece of data in my app and also update the algolia object, at the same time. The issue is that I want to create a function that can fetch an Algolia object based off it’s name and school ID, and then retrieve it’s objectID, but you can only get objects by objectID. When an object is added to my index, a random generated objectID is given to it by a function I created, i won’t be able to know the objectID every time, so I wanted to know if there’s a workaround where I can get the objectID of a Algolia object without using the method getObject(withID:)
. Thanks
Update!!!
So I figured out this work around by simply creating a variable that is a random number with 8 digits, and implementing it in the objectID of the record before it it added, as well as creating a new field in my Firestore document with the same variable. To my surprise, they successfully match up each time. I then used a function to make a query of that field, get it as a String, and place it in a textfield in a specific viewController so I can use it as a stored value for later. I can now use that stored algoliaObjectID as a parameter in the index.partialUpdateObject()
method, and it’s dynamic to every single piece of data which is awesome. The big issue now is the value: JSON
parameter in the method. I want the value of the value
parameter to be dynamic as well but it only takes in JSON and can’t figure out how I can work around that as well. If anybody knows and can help, that would be great. Thanks