summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-03-31 09:30:30 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-03-31 09:30:30 +0700
commitd0b45d86e85e1859755014c12de24c04699b5103 (patch)
tree8d67a570bc101d1edc33891366ecd770016716a1
parentc55f17416265b328c6a04d203c0fc49d00f08473 (diff)
change query for sync to solr
-rw-r--r--indoteknik_custom/models/apache_solr.py8
1 files 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: