Algolia still shows "out of stock" items in search results

Hi We are using magento 1.9.3.6 with Algolia Search 1.11.1
We have some out of stock items which we dont want them to be found on search autocomplete. Article about Algolia indexing says that only following items are being indexed :

  • Visible (catalog, search or both)
  • Enabled
  • Not deleted
  • In-stock (if you only want to show “in-stock” products)

Our item is currently set as “Stock Availability = out of stock”, “qty = 500”
Front-end shows item is out of stock. But when you search this item, it still shows on autocomplete

why is this product being indexed even though it is set to “in_stock = 0”?
Expected behaviour :
It shouldnt index those product which is set to “in_stock=0”, and shouldnt show them in autocomplete search results

Real behaviour:
algolia is indexing those products and showing them on search results

Look at the screenshots (All products are simple products, not configurable)

Hi @shoprazzi,

I have dug deeper on this issue. Could you test this patch and see if it fixes your issue?

If you have a GitHub account, you can comment on the pull request.

Thanks, I really appreciate your help.

Should i remove magento_products indices from algolia backend and re index from magento again?
or
after i applied this patch, clicking index from magento, will automatically remove out of stock products indexes from algolia backend which was indexed previously?

I applied the patch,
removed magento_products indices from algolia
i reindexed from magento backend

Search autocomplete is still showing out of stock items
search query : chanel # 5 and showing out of stock items

it has come to my attention, if i search “chanel #”, it doesnt show out of stock items
but if i add extra “5” after “#” , it shows out of stock items

I think, there is something related to numbers (digits), it out of product has digit in title, search results show.