diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-31 22:24:35 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-31 22:24:35 +0700 |
| commit | 9039bb8de5ea157692120b8b2dd24338a13a0071 (patch) | |
| tree | e369151cbc154be8bfd55aae1f7f0200191df6d3 | |
| parent | 604598292fa99546b34422613a8f6399e1a55c61 (diff) | |
<Miqdad> rev query (need improvement)
| -rw-r--r-- | indoteknik_custom/models/keywords.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/keywords.py b/indoteknik_custom/models/keywords.py index f6c1cf6e..b5c7ae8c 100644 --- a/indoteknik_custom/models/keywords.py +++ b/indoteknik_custom/models/keywords.py @@ -139,6 +139,8 @@ class Keywords(models.Model): brand_kw_1 = f"%{brand} {keyword_raw}%" brand_kw_2 = f"%{keyword_raw} {brand}%" + keyword = f"%{keyword_raw}%" + sql += "AND pt.x_manufacture = %s" sql += """ AND ( @@ -147,13 +149,22 @@ class Keywords(models.Model): OR pt.website_description ILIKE %s OR pt.website_description ILIKE %s ) + OR ( + pt.x_manufacture = %s + AND (pt.name ilike %s + OR pt.website_description ilike %s) + ) """ params.extend([ + record.brand_id.id, brand_kw_1, brand_kw_2, brand_kw_1, brand_kw_2, + record.brand_id.id, + keyword, + keyword ]) # ====================== |
