From d0b45d86e85e1859755014c12de24c04699b5103 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 31 Mar 2023 09:30:30 +0700 Subject: change query for sync to solr --- indoteknik_custom/models/apache_solr.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py index ff31e487..4cab66ec 100644 --- a/indoteknik_custom/models/apache_solr.py +++ b/indoteknik_custom/models/apache_solr.py @@ -14,13 +14,9 @@ class ApacheSolr(models.Model): def _sync_product_to_solr(self): _logger.info('run sync to solr...') solr = pysolr.Solr('http://10.148.0.5:8983/solr/product/', always_commit=True, timeout=30) + query = ["&","&",("type","=","product"),("active","=",True),"|",("solr_flag","=",0),("solr_flag","=",2)] - templates = self.env['product.template'].search([ - ('solr_flag', '=', 0), - ('type', '=', 'product'), - ('active', '=', True) - # ('id', '=', 21560) - ], limit=500) + templates = self.env['product.template'].search(query, limit=500) document = [] counter = 0 for template in templates: -- cgit v1.2.3