vuestorefront / mage2vuestorefront

Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront

Home Page:http://vuestorefront.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to remove products when removed in Magento?

haelbichalex opened this issue · comments

When you delete a product in Magento, this product will still exist in Elasticsearch. Running the full import would resolve this of course, but this takes a couple of hours for our environment so it's not really an option.
The productsdelta command on the other hand only updates products that were edited recently.

I have two ideas on how to solve this, but I'm not sure if I'm on the right track 😝

  1. When deleting a product, write the SKU in a new table and fetch this data when running the delta import. Afterwards clear the table.
  2. Directly do a delete-by-query call on elasticsearch with an observer after deleting a product

Isn't this what
node --harmony cli.js products --removeNonExistent=true --partitions=1
from
https://github.com/DivanteLtd/mage2vuestorefront
is supposed to do?

This will first run the full product import and delete all products not related to the current task: https://github.com/DivanteLtd/mage2vuestorefront/blob/c71788e1c918225685344657f9d6ca0b2417d801/src/cli.js#L255
I don't want to do the full import though, I just want to remove deleted products.

Hi there! Please do check the https://github.com/DivanteLtd/magento2-vsbridge-indexer - it should probably solve this problem.
The native Magento indexer removes products as they’re deleted in Magento

Hi there! @pkarw, @haelbichalex.
To sync product deletion with vue storefront, Should I just need to follow this steps as described in this guide https://github.com/DivanteLtd/magento2-vsbridge-indexer or anything else need to change/update.

And one more question that,
I need to process only those records which are created/updated/deleted for cms, products and which are supported.
If I run these command frequently through cron job then does it will increase memory and process all records?
Because I run yarn mage2vs import too many times and it create new indices. I have checked using this http://localhost:9200/_cat/indices?v

Even when I run this command through cron node --harmony cli.js pages. It increase docs.deleted. And memory(pri.store.size) also.

image

So can you please describe me that how it is working. And correct if I am doing anything wrong.

Closing this, as we decided to use https://github.com/DivanteLtd/magento2-vsbridge-indexer instead and this repo seems redundant now.