diff --git a/config/config.yaml b/config/config.yaml index dd92457..cb6edfb 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -397,9 +397,15 @@ services: enforce_eager: false infer_batch_size: 100 sort_by_doc_length: true - # "rank products by given query" 比 “Given a query, score the product for relevance” 更好点 - instruction: "rank products by given query" # instruction: "Given a query, score the product for relevance" + # "rank products by given query" 比 “Given a query, score the product for relevance” 更好点 + # instruction: "rank products by given query, category match first" + # instruction: "Rank products by query relevance, prioritizing category match" + # instruction: "Rank products by query relevance, prioritizing category and style match" + # instruction: "Rank by query relevance, prioritize category & style" + # instruction: "Relevance ranking: category & style match first" + # instruction: "Score product relevance by query with category & style match prioritized" + instruction: "Rank products by query with category & style match prioritized" qwen3_transformers: model_name: "Qwen/Qwen3-Reranker-0.6B" instruction: "rank products by given query" diff --git a/frontend/static/js/tenant_facets_config.js b/frontend/static/js/tenant_facets_config.js index 7c80dad..9e087d4 100644 --- a/frontend/static/js/tenant_facets_config.js +++ b/frontend/static/js/tenant_facets_config.js @@ -2,7 +2,7 @@ // 根据不同的 tenant_id 配置不同的分面字段名、显示标签和容器ID const TENANT_FACETS_CONFIG = { // tenant_id=162: 使用小写的规格名称 - "162": { + "163": { specificationFields: [ { field: "specifications.color", diff --git a/search/sku_intent_selector.py b/search/sku_intent_selector.py index 4f9216a..9b49e06 100644 --- a/search/sku_intent_selector.py +++ b/search/sku_intent_selector.py @@ -41,6 +41,7 @@ class _SkuCandidate: selection_text: str normalized_selection_text: str intent_values: Dict[str, str] + normalized_intent_values: Dict[str, str] @dataclass @@ -235,29 +236,36 @@ class StyleSkuSelector: candidates: List[_SkuCandidate] = [] for index, sku in enumerate(skus): intent_values: Dict[str, str] = {} + normalized_intent_values: Dict[str, str] = {} for intent_type, field_name in resolved_dimensions.items(): if not field_name: continue - intent_values[intent_type] = str(sku.get(field_name) or "").strip() + raw = str(sku.get(field_name) or "").strip() + intent_values[intent_type] = raw + normalized_intent_values[intent_type] = normalize_query_text(raw) selection_parts: List[str] = [] - seen = set() - for value in intent_values.values(): - normalized = normalize_query_text(value) - if not normalized or normalized in seen: + norm_parts: List[str] = [] + seen: set[str] = set() + for intent_type, raw in intent_values.items(): + nv = normalized_intent_values[intent_type] + if not nv or nv in seen: continue - seen.add(normalized) - selection_parts.append(value) + seen.add(nv) + selection_parts.append(raw) + norm_parts.append(nv) selection_text = " ".join(selection_parts).strip() + normalized_selection_text = " ".join(norm_parts).strip() candidates.append( _SkuCandidate( index=index, sku_id=str(sku.get("sku_id") or ""), sku=sku, selection_text=selection_text, - normalized_selection_text=normalize_query_text(selection_text), + normalized_selection_text=normalized_selection_text, intent_values=intent_values, + normalized_intent_values=normalized_intent_values, ) ) return candidates @@ -280,8 +288,11 @@ class StyleSkuSelector: intent_type: str, value: str, selection_context: _SelectionContext, + *, + normalized_value: Optional[str] = None, ) -> bool: - normalized_value = normalize_query_text(value) + if normalized_value is None: + normalized_value = normalize_query_text(value) if not normalized_value: return False @@ -307,7 +318,12 @@ class StyleSkuSelector: ) -> Optional[_SkuCandidate]: for candidate in candidates: if candidate.intent_values and all( - self._is_text_match(intent_type, value, selection_context) + self._is_text_match( + intent_type, + value, + selection_context, + normalized_value=candidate.normalized_intent_values[intent_type], + ) for intent_type, value in candidate.intent_values.items() ): return candidate -- libgit2 0.21.2