iOS InstantSearch - how to refresh HitsTableWidget view if one of the object is deleted


I want the HitsTableWidget to automatically update/refresh if one of the hit objects is deleted.

I tried using “table.reloadHits()” - after deleting the object - but that did not work. The table only refreshes/updates if I put the cursor on the search bar. Is there an API which will refresh the HitsTableWidget display results?


Hey @shoplike.admn,

The reloadHits’s job is only presentational: to present the new data from the data source.

If an object in the data source has been deleted and requires a fresh new search, then you should do a new search by doing something like This should in turn automatically reload the hitsTableWidget if it’s been properly registered to InstantSearch with either register(widget:) or registerAllWidgets(in:) beforehand.


Unfortunately that did not seem to work for me.

I have a delete button in the Table View Cell. If I press the delete button, it will delete the object in Algolia Index database. However the HitsTableWidget is not automatically updating the hit results and still shows that object. I did call on completion handler of deleteObject - and have registered the tableView (HitsTableWidget) to InstantSearch.

However if I subsequently touch/click on the SearchBar (without typing anything) - the HitsTableWidget updates and removes that object from the view. I am looking for a way to do the same without needing to click on the Search Bar.


Hi @guy.daher, any idea on what could be missing, and why its not getting automatically refreshed? Do I need to reload anything after calling Thanks

Hi @shoplike.admn,

sorry for missing your previous message. Usually when calling the search method on InstantSearch, if the tableView is registered, it will be reloaded behind the scenes. I am not sure why this isn’t happening. Could you copy paste some code snippet of your ViewController where you do all of this? Like this I can better see what is going on.

As a temporary fix, what you can do now is force a reload of the tableView yourself when you delete object.