From 2ca257f21bd5087604e3d0110eff16e40b0d8f83 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 18 Jun 2024 16:27:52 +0700 Subject: bf --- indoteknik_custom/models/solr/apache_solr.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/solr/apache_solr.py b/indoteknik_custom/models/solr/apache_solr.py index d25b5fd6..0b1bd821 100644 --- a/indoteknik_custom/models/solr/apache_solr.py +++ b/indoteknik_custom/models/solr/apache_solr.py @@ -295,6 +295,7 @@ class ApacheSolr(models.Model): def _solr_sync_recommendation(self, limit=100): variants = self.env['product.product'].search([('solr_flag', '=', 2)], limit=limit) + documents = [] document = {} for variant in variants: if variant.product_tmpl_id: # Check if product_tmpl_id exists @@ -310,7 +311,9 @@ class ApacheSolr(models.Model): 'type_s': variant.product_tmpl_id.type or '' } variant.write({'solr_flag': 1}) # Ensure the flag is updated correctly - _recommendation_solr.add(document) + documents.append(document) except Exception as e: _logger.error("Failed to add document to Solr: %s", e) _logger.error("Document data: %s", document) + _recommendation_solr.add(documents) + return True -- cgit v1.2.3