Open navigation

Sync Data using Collection method

The Klevu Magento 2 extension includes a setting "Use Collection Method" which can be found under Stores > Configuration > Klevu > Search Configuration > Developer Settings. There are two options for this: 'Yes' and 'No'

We recommend that you select 'Yes' for best sync performance, however when doing so it is important that you are correctly maintaining your Magento indexes in order to send the correct product information to Klevu.

Object Method

With 'Use Collection Method: No', Klevu will call `$product->load()` on every Product in your catalog which needs to be synced. The benefit of this approach is it ensures the most up to date information is retrieved, since Magento uses the 'EAV tables' to fetch the information it needs, which is the same information it uses to display prices on the Product Detail Page. However, it takes a long time since each load operation can take around 0.5 to 1 second for each product. If you have less than 5,000 products (including variants) then this can be acceptable, but above this you will find the sync process takes too long and sometimes even fails.

Collection Method

With 'Use Collection Method: Yes', Klevu will instead load around 100 products at a time, rather than one at a time. This time Magento uses the 'Index tables' to fetch the relevant information it needs, which is the same information it uses to display prices on the Category Listing Pages. These index tables require that you are regularly running the Magento cron to keep prices and other such information up to date within your Magento instance. Therefore when using the Collection Method, you must ensure that your Magento indexes are kept up to date.

How to Enable
  1. Login into your Magento Admin Panel
  2. Go to Stores → Configuration → Klevu → Search Configuration
  3. Go to Developer Settings at the bottom (only visible at "Default Config" level)
  4. Choose "Yes" for Use Collection Method option
  5. Save the Configuration

 

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.