# Unified Configuration for Multi-Tenant Search Engine # 统一配置文件,所有租户共用一套配置 # 注意:索引结构由 mappings/search_products.json 定义,此文件只配置搜索行为 # Elasticsearch Index es_index_name: "search_products" # ES Index Settings (基础设置) es_settings: number_of_shards: 1 number_of_replicas: 0 refresh_interval: "30s" # 字段权重配置(用于搜索时的字段boost) # 统一按“字段基名”配置;查询时按 search_langs 动态拼接 .{lang}。 # 若需要按某个语言单独调权,也可以加显式 key(例如 title.de: 3.2)。 field_boosts: title: 3.0 brief: 1.5 description: 1.0 vendor: 1.5 category_path: 1.5 category_name_text: 1.5 tags: 1.0 option1_values: 0.5 option2_values: 0.5 option3_values: 0.5 # Query Configuration(查询配置) query_config: # 支持的语言 supported_languages: - "zh" - "en" default_language: "en" # 功能开关(翻译开关由tenant_config控制) enable_text_embedding: true enable_query_rewrite: true # 动态多语言检索字段配置 # multilingual_fields 会被拼成 title.{lang}/brief.{lang}/... 形式; # shared_fields 为无语言后缀字段。 search_fields: multilingual_fields: - "title" - "brief" - "description" - "vendor" - "category_path" - "category_name_text" shared_fields: - "tags" - "option1_values" - "option2_values" - "option3_values" core_multilingual_fields: - "title" - "brief" - "vendor" - "category_name_text" # 统一文本召回策略(主查询 + 翻译查询 + phrase/keywords) text_query_strategy: base_minimum_should_match: "75%" translation_minimum_should_match: "75%" translation_boost: 0.4 translation_boost_when_source_missing: 1.0 source_boost_when_missing: 0.6 original_query_fallback_boost_when_translation_missing: 0.2 keywords_boost: 0.1 enable_phrase_query: true tie_breaker_base_query: 0.9 tie_breaker_keywords: 0.9 # Embedding字段名称 text_embedding_field: "title_embedding" image_embedding_field: null # 返回字段配置(_source includes) # null表示返回所有字段,[]表示不返回任何字段,列表表示只返回指定字段 source_fields: null # KNN boost配置(向量召回的boost值) knn_boost: 0.25 # Lower boost for embedding recall # Function Score配置(ES层打分规则) function_score: score_mode: "sum" boost_mode: "multiply" functions: [] # 重排配置(provider/URL 在 services.rerank) rerank: enabled: true rerank_window: 384 timeout_sec: 15.0 weight_es: 0.4 weight_ai: 0.6 rerank_query_template: "{query}" rerank_doc_template: "{title}" # 可扩展服务/provider 注册表(单一配置源) services: translation: service_url: "http://127.0.0.1:6006" default_model: "llm" default_scene: "general" timeout_sec: 10.0 cache: enabled: true key_prefix: "trans:v2" ttl_seconds: 62208000 sliding_expiration: true key_include_scene: true key_include_source_lang: true capabilities: qwen-mt: enabled: true backend: "qwen_mt" model: "qwen-mt-flash" base_url: "https://dashscope-us.aliyuncs.com/compatible-mode/v1" timeout_sec: 10.0 use_cache: true llm: enabled: true backend: "llm" model: "qwen-flash" base_url: "https://dashscope-us.aliyuncs.com/compatible-mode/v1" timeout_sec: 30.0 deepl: enabled: false backend: "deepl" api_url: "https://api.deepl.com/v2/translate" timeout_sec: 10.0 glossary_id: "" nllb-200-distilled-600m: enabled: true backend: "local_nllb" model_id: "facebook/nllb-200-distilled-600M" model_dir: "./models/translation/facebook/nllb-200-distilled-600M" device: "cuda" torch_dtype: "float16" batch_size: 16 max_input_length: 256 max_new_tokens: 64 num_beams: 1 attn_implementation: "sdpa" opus-mt-zh-en: enabled: true backend: "local_marian" model_id: "Helsinki-NLP/opus-mt-zh-en" model_dir: "./models/translation/Helsinki-NLP/opus-mt-zh-en" device: "cuda" torch_dtype: "float16" batch_size: 16 max_input_length: 256 max_new_tokens: 256 num_beams: 1 opus-mt-en-zh: enabled: true backend: "local_marian" model_id: "Helsinki-NLP/opus-mt-en-zh" model_dir: "./models/translation/Helsinki-NLP/opus-mt-en-zh" device: "cuda" torch_dtype: "float16" batch_size: 16 max_input_length: 256 max_new_tokens: 256 num_beams: 1 embedding: provider: "http" # http base_url: "http://127.0.0.1:6005" providers: http: base_url: "http://127.0.0.1:6005" # 服务内文本后端(embedding 进程启动时读取) backend: "tei" # tei | local_st backends: tei: base_url: "http://127.0.0.1:8080" timeout_sec: 20 model_id: "Qwen/Qwen3-Embedding-0.6B" local_st: model_id: "Qwen/Qwen3-Embedding-0.6B" device: "cuda" batch_size: 32 normalize_embeddings: true rerank: provider: "http" base_url: "http://127.0.0.1:6007" providers: http: base_url: "http://127.0.0.1:6007" service_url: "http://127.0.0.1:6007/rerank" # 服务内后端(reranker 进程启动时读取) backend: "qwen3_vllm" # bge | qwen3_vllm | qwen3_transformers | dashscope_rerank backends: bge: model_name: "BAAI/bge-reranker-v2-m3" device: null use_fp16: true batch_size: 64 max_length: 512 cache_dir: "./model_cache" enable_warmup: true qwen3_vllm: model_name: "Qwen/Qwen3-Reranker-0.6B" engine: "vllm" max_model_len: 256 tensor_parallel_size: 1 gpu_memory_utilization: 0.36 dtype: "float16" enable_prefix_caching: true enforce_eager: false infer_batch_size: 64 sort_by_doc_length: true length_sort_mode: "char" # char | token instruction: "Given a shopping query, rank product titles by relevance" qwen3_transformers: model_name: "Qwen/Qwen3-Reranker-0.6B" instruction: "Given a shopping query, rank product titles by relevance" max_length: 8192 batch_size: 64 use_fp16: true attn_implementation: "flash_attention_2" dashscope_rerank: model_name: "qwen3-rerank" # 按地域选择 endpoint: # 中国: https://dashscope.aliyuncs.com/compatible-api/v1/reranks # 新加坡: https://dashscope-intl.aliyuncs.com/compatible-api/v1/reranks # 美国: https://dashscope-us.aliyuncs.com/compatible-api/v1/reranks endpoint: "https://dashscope.aliyuncs.com/compatible-api/v1/reranks" api_key_env: "RERANK_DASHSCOPE_API_KEY_CN" timeout_sec: 10.0 # top_n_cap: 0 # 0 表示 top_n=当前请求文档数;>0 则限制 top_n 上限 batchsize: 64 # 0 关闭;>0 启用并发小包调度(top_n/top_n_cap 仍生效,分包后全局截断) instruct: "Given a shopping query, rank product titles by relevance" max_retries: 2 retry_backoff_sec: 0.2 # SPU配置(已启用,使用嵌套skus) spu_config: enabled: true spu_field: "spu_id" inner_hits_size: 10 # 配置哪些option维度参与检索(进索引、以及在线搜索) # 格式为list,选择option1/option2/option3中的一个或多个 searchable_option_dimensions: ['option1', 'option2', 'option3'] # 租户配置(Tenant Configuration) # 每个租户可配置主语言 primary_language 与索引语言 index_languages(主市场语言,商家可勾选) # 默认 index_languages: [en, zh],可配置为任意 SOURCE_LANG_CODE_MAP.keys() 的子集 tenant_config: default: primary_language: "en" index_languages: ["en", "zh"] tenants: "1": primary_language: "zh" index_languages: ["zh", "en"] "2": primary_language: "en" index_languages: ["en", "zh"] "3": primary_language: "zh" index_languages: ["zh", "en"] "162": primary_language: "zh" index_languages: ["zh", "en"] "170": primary_language: "en" index_languages: ["en", "zh"]