From a7c5bef3987edb8bab1fce6219d9bfdce1fc65af Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 30 Mar 2023 09:47:07 +0700 Subject: only active product for solr --- indoteknik_custom/models/apache_solr.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/apache_solr.py b/indoteknik_custom/models/apache_solr.py index 1f84e252..50f3d8f1 100644 --- a/indoteknik_custom/models/apache_solr.py +++ b/indoteknik_custom/models/apache_solr.py @@ -13,11 +13,12 @@ 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=100) + solr = pysolr.Solr('http://192.168.23.5:8983/solr/product/', always_commit=True, timeout=100) templates = self.env['product.template'].search([ ('solr_flag', '=', 0), - ('type', '=', 'product') + ('type', '=', 'product'), + ('active', '=', True) # ('id', '=', 21560) ], limit=500) document = [] @@ -62,8 +63,7 @@ class ApacheSolr(models.Model): 'variants_name_t': variants_name, 'variants_code_t': variants_code, 'search_rank_i': template.search_rank, - 'search_rank_weekly_i': template.search_rank_weekly, - 'active_b': template.active + 'search_rank_weekly_i': template.search_rank_weekly })] solr.add(document) template.solr_flag = 1 -- cgit v1.2.3