Blame view

config/config.yaml 4.7 KB
4d824a77   tangwang   所有租户共用一套统一配置.tena...
1
  # Unified Configuration for Multi-Tenant Search Engine
33839b37   tangwang   属性值参与搜索:
2
3
  # 统一配置文件,所有租户共用一套配置
  # 注意:索引结构由 mappings/search_products.json 定义,此文件只配置搜索行为
4d824a77   tangwang   所有租户共用一套统一配置.tena...
4
5
6
7
  
  # Elasticsearch Index
  es_index_name: "search_products"
  
33839b37   tangwang   属性值参与搜索:
8
  # ES Index Settings (基础设置)
4d824a77   tangwang   所有租户共用一套统一配置.tena...
9
10
11
12
13
  es_settings:
    number_of_shards: 1
    number_of_replicas: 0
    refresh_interval: "30s"
  
33839b37   tangwang   属性值参与搜索:
14
15
16
17
18
19
20
21
22
23
24
25
26
  # 字段权重配置(用于搜索时的字段boost)
  # 只配置权重,不配置字段结构(字段结构由 mappings/search_products.json 定义)
  field_boosts:
    # 文本相关性字段
    title_zh: 3.0
    brief_zh: 1.5
    description_zh: 1.0
    vendor_zh: 1.5
    title_en: 3.0
    brief_en: 1.5
    description_en: 1.0
    vendor_en: 1.5
    
5dcddc06   tangwang   索引重构
27
    # 分类相关字段
33839b37   tangwang   属性值参与搜索:
28
29
30
31
32
33
34
35
36
37
38
39
40
    category_path_zh: 1.5
    category_name_zh: 1.5
    category_path_en: 1.5
    category_name_en: 1.5
    
    # 标签和属性值字段
    tags: 1.0
    option1_values: 0.5
    option2_values: 0.5
    option3_values: 0.5
  
  # 搜索域配置(Query Domains)
  # 定义不同的搜索策略,指定哪些字段组合在一起搜索
4d824a77   tangwang   所有租户共用一套统一配置.tena...
41
42
  indexes:
    - name: "default"
33839b37   tangwang   属性值参与搜索:
43
      label: "默认搜索"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
44
      fields:
5dcddc06   tangwang   索引重构
45
46
47
48
        - "title_zh"
        - "brief_zh"
        - "description_zh"
        - "vendor_zh"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
49
        - "tags"
5dcddc06   tangwang   索引重构
50
51
        - "category_path_zh"
        - "category_name_zh"
33839b37   tangwang   属性值参与搜索:
52
        - "option1_values"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
53
54
55
      boost: 1.0
  
    - name: "title"
33839b37   tangwang   属性值参与搜索:
56
      label: "标题搜索"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
57
      fields:
5dcddc06   tangwang   索引重构
58
        - "title_zh"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
59
60
61
      boost: 2.0
  
    - name: "vendor"
33839b37   tangwang   属性值参与搜索:
62
      label: "品牌搜索"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
63
      fields:
5dcddc06   tangwang   索引重构
64
        - "vendor_zh"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
65
66
67
      boost: 1.5
  
    - name: "category"
33839b37   tangwang   属性值参与搜索:
68
      label: "类目搜索"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
69
      fields:
5dcddc06   tangwang   索引重构
70
71
        - "category_path_zh"
        - "category_name_zh"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
72
73
74
      boost: 1.5
  
    - name: "tags"
33839b37   tangwang   属性值参与搜索:
75
      label: "标签搜索"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
76
77
      fields:
        - "tags"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
78
79
      boost: 1.0
  
33839b37   tangwang   属性值参与搜索:
80
  # Query Configuration(查询配置)
4d824a77   tangwang   所有租户共用一套统一配置.tena...
81
  query_config:
33839b37   tangwang   属性值参与搜索:
82
    # 支持的语言
4d824a77   tangwang   所有租户共用一套统一配置.tena...
83
84
85
86
    supported_languages:
      - "zh"
      - "en"
    default_language: "zh"
33839b37   tangwang   属性值参与搜索:
87
88
    
    # 功能开关
4d824a77   tangwang   所有租户共用一套统一配置.tena...
89
90
91
    enable_translation: true
    enable_text_embedding: true
    enable_query_rewrite: true
7bc756c5   tangwang   优化 ES 查询构建
92
    enable_multilang_search: true  # 启用多语言搜索(使用翻译进行跨语言检索)
4d824a77   tangwang   所有租户共用一套统一配置.tena...
93
  
33839b37   tangwang   属性值参与搜索:
94
95
96
    # Embedding字段名称
    text_embedding_field: "title_embedding"
    image_embedding_field: null
325eec03   tangwang   1. 日志、配置基础设施,使用优化
97
  
33839b37   tangwang   属性值参与搜索:
98
    # Embedding禁用阈值(短查询不使用向量搜索)
9f96d6f3   tangwang   短query不用语义搜索
99
    embedding_disable_thresholds:
33839b37   tangwang   属性值参与搜索:
100
101
      chinese_char_limit: 4
      english_word_limit: 3
9f96d6f3   tangwang   短query不用语义搜索
102
  
33839b37   tangwang   属性值参与搜索:
103
    # 翻译API配置
4d824a77   tangwang   所有租户共用一套统一配置.tena...
104
    translation_service: "deepl"
33839b37   tangwang   属性值参与搜索:
105
106
    translation_api_key: null  # 通过环境变量设置
    
0064e946   tangwang   feat: 增量索引服务、租户配置...
107
108
109
110
111
112
113
114
115
116
117
118
    # 翻译提示词配置(用于提高翻译质量,作为DeepL API的context参数)
    translation_prompts:
      # 商品标题翻译提示词
      product_title_zh: "请将原文翻译成中文商品SKU名称,要求:确保精确、完整地传达原文信息的基础上,语言简洁清晰、地道、专业。"
      product_title_en: "Translate the original text into an English product SKU name. Requirements: Ensure accurate and complete transmission of the original information, with concise, clear, authentic, and professional language."
      # query翻译提示词
      query_zh: "电商领域"
      query_en: "e-commerce domain"
      # 默认翻译用词
      default_zh: "电商领域"
      default_en: "e-commerce domain"
    
33839b37   tangwang   属性值参与搜索:
119
120
121
    # 返回字段配置(_source includes)
    # null表示返回所有字段,[]表示不返回任何字段,列表表示只返回指定字段
    source_fields: null
4d824a77   tangwang   所有租户共用一套统一配置.tena...
122
  
33839b37   tangwang   属性值参与搜索:
123
  # Ranking Configuration(排序配置)
4d824a77   tangwang   所有租户共用一套统一配置.tena...
124
125
126
127
128
129
130
131
  ranking:
    expression: "bm25() + 0.2*text_embedding_relevance()"
    description: "BM25 text relevance combined with semantic embedding similarity"
  
  # Function Score配置(ES层打分规则)
  function_score:
    score_mode: "sum"
    boost_mode: "multiply"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
132
133
134
135
136
137
138
139
    functions: []
  
  # Rerank配置(本地重排,当前禁用)
  rerank:
    enabled: false
    expression: ""
    description: "Local reranking (disabled, use ES function_score instead)"
  
cadc77b6   tangwang   索引字段名、变量名、API数据结构...
140
  # SPU配置(已启用,使用嵌套skus)
4d824a77   tangwang   所有租户共用一套统一配置.tena...
141
142
  spu_config:
    enabled: true
cadc77b6   tangwang   索引字段名、变量名、API数据结构...
143
    spu_field: "spu_id"
4d824a77   tangwang   所有租户共用一套统一配置.tena...
144
    inner_hits_size: 10
33839b37   tangwang   属性值参与搜索:
145
146
147
    # 配置哪些option维度参与检索(进索引、以及在线搜索)
    # 格式为list,选择option1/option2/option3中的一个或多个
    searchable_option_dimensions: ['option1', 'option2', 'option3']
0064e946   tangwang   feat: 增量索引服务、租户配置...
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
  
  # 租户配置(Tenant Configuration)
  # 每个租户可以配置主语言和翻译选项
  tenant_config:
    # 默认配置(未配置的租户使用此配置)
    default:
      primary_language: "zh"
      translate_to_en: true
      translate_to_zh: false
    # 租户特定配置
    tenants:
      "1":
        primary_language: "zh"
        translate_to_en: true
        translate_to_zh: false
      "2":
        primary_language: "en"
        translate_to_en: false
        translate_to_zh: true
      "3":
        primary_language: "zh"
        translate_to_en: true
        translate_to_zh: false
      "162":
        primary_language: "zh"
        translate_to_en: false
        translate_to_zh: false