Hi,
I'm not able to reproduce the issue on my end with HikaShop 5.0.4
When I unpublish a product via the HikaShop interface, the product doesn't appear in the search results of the Smart search, and if I then publish it again, it appears again.
There is nothing particular to setup.
However, I can think of ways for this to happen.
If you disabled the Smart search HikaShop products plugin in the Joomla plugins manager after indexing your products, everything you change in the products after this won't be taken into account by the Smart search.
Also, if the products are being unpublished via a custom plugin, a massaction, or a CSV import, the normal events of a product being updated might not be triggered. And in that case, the Smart search HikaShop products plugin won't be able to refresh the index.
However, in that case, if you do a full reindex of the content in the Smart search component, it should then have the proper state.
That's the issue with using an index. You can get better performances, and do things that would be impossible with a dynamic search (like the previous search system of Joomla, or HikaShop's filters), but when you search, you search in the index, not on the actual data. So if there is a synchronisation issue between the index and the actual data, you can get results like what you're describing, while this can't happen with a dynamic search.