summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/solr/apache_solr.py5
1 files changed, 4 insertions, 1 deletions
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