doofinder / doofinder-wordpress

Integrate Doofinder in your WordPress site with (almost) no effort.
GNU General Public License v3.0
2 stars 3 forks source link

Refactor Update on save Woocommerce/Wordpress plugin with Doomanager #54

Closed albertodoofinder closed 1 year ago

albertodoofinder commented 1 year ago

Analize and use of API for update on save in Wordpress with Doomanager.

Document code. Create / update functional tests. Create Update on save mermaid diagrams in doomanager repo.

blocked by https://github.com/doofinder/doofinder-wordpress/issues/44

blocks https://github.com/doofinder/doofinder-wordpress/issues/55 https://github.com/doofinder/doofinder-wordpress/issues/43

eduardogomez97 commented 1 year ago

The main idea is to use the same system that is being used in other platforms like prestashop or magento2.

We use the wordpress hook to know when an item has been updated. The ID of this item and its type is stored in a database table called doofinder_update_on_save.

You select in the plugin settings how often you want to send the update on save.

After that time the ID's are separated in different lists according to the type. A bulk of data is built for each element of the list and the bulk is sent to an endpoint prepared in doomanager that receives it together with the type. We pass it through the Items_transformation and send it to DoofAPI to index it in the corresponding index.

eduardogomez97 commented 1 year ago

I have tried to implement the update on save integration with the wordpress cron. But it presents the same problems as in prestashop, it does not let us use a custom concurrency associating it in php and the associated task does not run because it seems that it would have to be globalized.

Image

Image

Image

Image

So we are going to apply the same solution that was applied in Prestashop and I will create a issue to investigate the cron with more time.

eduardogomez97 commented 1 year ago

After starting to develop how to generate the product bulk and the construction of the items I have seen that there was a better alternative that was previously rejected.

But after researching that alternative and proposing it to @peillis . We have come to the conclusion that it is the best way to unify the processes. So the new way would be:

* It is necessary to investigate how to do that in this case it does not replace the complete index, it only updates if it exists or creates if it does not. POST -> PATCH

eduardogomez97 commented 1 year ago

After researching and discussing it, the best thing to do is to have all plugin clients centered in one library and have both update on save and doofeeds pull from it. So as not to have several bulk build points. For the moment the easiest way is to create your own client in doomanager. We have pending to talk about launching task or do it directly.

eduardogomez97 commented 1 year ago

All the Wordpress PR has been corrected. But you can not merge until the rest of the tasks are done because you have to upload everything as a single major version.

The part of doomanager has already been uploaded.