[V10.345] 收斂 PChome 搜尋詞特定品線
All checks were successful
CD Pipeline / deploy (push) Successful in 1m34s

This commit is contained in:
OoO
2026-05-20 16:28:59 +08:00
parent e7ab333c58
commit 67cd35e2de
4 changed files with 54 additions and 2 deletions

View File

@@ -468,6 +468,26 @@ def test_marketplace_search_terms_keep_professional_product_phrase():
assert not any("卸除防曬" in term or "外出清潔" in term for term in mustela_terms)
def test_marketplace_search_terms_prefer_specific_line_over_generic_usage_words():
from services.marketplace_product_matcher import build_search_terms
mask_terms = build_search_terms("【SK-II】官方直營 青春敷面膜10+6+6送12(保濕/面膜/超品日)", max_terms=5)
bottle_terms = build_search_terms(
"【LANCOME 蘭蔻】官方直營 經典款小黑瓶100ml雙入組(LANCOME/經典款/抗老)",
max_terms=5,
)
rose_terms = build_search_terms(
"【蘭蔻】官方直營 玫瑰霜60ml+玫瑰精露150ml(LANCOME/永生玫瑰霜/抗老/PDRN)",
max_terms=5,
)
assert mask_terms[0] == "sk ii 青春敷面膜"
assert bottle_terms[0] == "蘭蔻 小黑瓶 100ml"
assert rose_terms[0] == "蘭蔻 永生玫瑰霜 60ml"
assert "抗老" not in " ".join(bottle_terms[:3] + rose_terms[:3])
assert "pdrn" not in " ".join(term.lower() for term in rose_terms[:3])
def test_batch_compare_top_uses_latest_momo_price_not_revenue(monkeypatch):
from services import pchome_crawler