Commit af249836e9e9e1bc701a1db828d01ffe80eea58b

Authored by tangwang
1 parent 8d227b96

文档完善

Showing 1 changed file with 22 additions and 71 deletions   Show diff stats
docs/搜索API对接指南.md
@@ -6,10 +6,9 @@ @@ -6,10 +6,9 @@
6 6
7 1. [快速开始](#快速开始) 7 1. [快速开始](#快速开始)
8 2. [接口概览](#接口概览) 8 2. [接口概览](#接口概览)
9 -3. [文本搜索接口](#文本搜索接口)  
10 -4. [图片搜索接口](#图片搜索接口)  
11 -5. [响应格式说明](#响应格式说明)  
12 -6. [常见场景示例](#常见场景示例) 9 +3. [搜索接口](#搜索接口)
  10 +4. [响应格式说明](#响应格式说明)
  11 +5. [常见场景示例](#常见场景示例)
13 12
14 --- 13 ---
15 14
@@ -79,7 +78,7 @@ curl -X POST "http://localhost:6002/search/" \ @@ -79,7 +78,7 @@ curl -X POST "http://localhost:6002/search/" \
79 78
80 --- 79 ---
81 80
82 -## 文本搜索接口 81 +## 搜索接口
83 82
84 ### 接口信息 83 ### 接口信息
85 84
@@ -112,19 +111,19 @@ curl -X POST "http://localhost:6002/search/" \ @@ -112,19 +111,19 @@ curl -X POST "http://localhost:6002/search/" \
112 111
113 | 参数 | 类型 | 必填 | 默认值 | 说明 | 112 | 参数 | 类型 | 必填 | 默认值 | 说明 |
114 |------|------|------|--------|------| 113 |------|------|------|--------|------|
115 -| `tenant_id` | string | ✅ | - | 租户ID,用于隔离不同站点或客户的数据 |  
116 -| `query` | string | ✅ | - | 搜索查询字符串,支持布尔表达式(AND, OR, RANK, ANDNOT) |  
117 -| `size` | integer | ❌ | 10 | 返回结果数量(1-100) |  
118 -| `from` | integer | ❌ | 0 | 分页偏移量(用于分页) |  
119 -| `filters` | object | ❌ | null | 精确匹配过滤器(见下文) |  
120 -| `range_filters` | object | ❌ | null | 数值范围过滤器(见下文) |  
121 -| `facets` | array | ❌ | null | 分面配置(见下文) |  
122 -| `sort_by` | string | ❌ | null | 排序字段名(如 `min_price`, `max_price`, `title`) |  
123 -| `sort_order` | string | ❌ | "desc" | 排序方向:`asc`(升序)或 `desc`(降序) |  
124 -| `min_score` | float | ❌ | null | 最小相关性分数阈值 |  
125 -| `debug` | boolean | ❌ | false | 是否返回调试信息 |  
126 -| `user_id` | string | ❌ | null | 用户ID(用于个性化,预留) |  
127 -| `session_id` | string | ❌ | null | 会话ID(用于分析,预留) | 114 +| `tenant_id` | string | Y | - | 租户ID,用于隔离不同站点或客户的数据 |
  115 +| `query` | string | Y | - | 搜索查询字符串,支持布尔表达式(AND, OR, RANK, ANDNOT) |
  116 +| `size` | integer | N | 10 | 返回结果数量(1-100) |
  117 +| `from` | integer | N | 0 | 分页偏移量(用于分页) |
  118 +| `filters` | object | N | null | 精确匹配过滤器(见下文) |
  119 +| `range_filters` | object | N | null | 数值范围过滤器(见下文) |
  120 +| `facets` | array | N | null | 分面配置(见下文) |
  121 +| `sort_by` | string | N | null | 排序字段名(如 `min_price`, `max_price`, `title`) |
  122 +| `sort_order` | string | N | "desc" | 排序方向:`asc`(升序)或 `desc`(降序) |
  123 +| `min_score` | float | N | null | 最小相关性分数阈值 |
  124 +| `debug` | boolean | N | false | 是否返回调试信息 |
  125 +| `user_id` | string | N | null | 用户ID(用于个性化,预留) |
  126 +| `session_id` | string | N | null | 会话ID(用于分析,预留) |
128 127
129 ### 过滤器详解 128 ### 过滤器详解
130 129
@@ -264,54 +263,6 @@ curl -X POST "http://localhost:6002/search/" \ @@ -264,54 +263,6 @@ curl -X POST "http://localhost:6002/search/" \
264 263
265 --- 264 ---
266 265
267 -## 图片搜索接口  
268 -  
269 -### 接口信息  
270 -  
271 -- **端点**: `POST /search/image`  
272 -- **描述**: 基于图片相似度进行搜索,使用图片向量进行语义匹配  
273 -  
274 -### 请求参数  
275 -  
276 -```json  
277 -{  
278 - "image_url": "string (required)",  
279 - "size": 10,  
280 - "filters": {},  
281 - "range_filters": {}  
282 -}  
283 -```  
284 -  
285 -### 参数说明  
286 -  
287 -| 参数 | 类型 | 必填 | 默认值 | 描述 |  
288 -|------|------|------|--------|------|  
289 -| `image_url` | string | ✅ | - | 查询图片的 URL |  
290 -| `size` | integer | ❌ | 10 | 返回结果数量(1-100) |  
291 -| `filters` | object | ❌ | null | 精确匹配过滤器 |  
292 -| `range_filters` | object | ❌ | null | 数值范围过滤器 |  
293 -  
294 -### 请求示例  
295 -  
296 -```bash  
297 -curl -X POST "http://localhost:6002/search/image" \  
298 - -H "Content-Type: application/json" \  
299 - -d '{  
300 - "image_url": "https://example.com/barbie.jpg",  
301 - "size": 20,  
302 - "filters": {  
303 - "category_keyword": "玩具"  
304 - },  
305 - "range_filters": {  
306 - "min_price": {  
307 - "lte": 100  
308 - }  
309 - }  
310 - }'  
311 -```  
312 -  
313 ----  
314 -  
315 ## 响应格式说明 266 ## 响应格式说明
316 267
317 ### 标准响应结构 268 ### 标准响应结构
@@ -557,9 +508,9 @@ curl -X POST "http://localhost:6002/search/image" \ @@ -557,9 +508,9 @@ curl -X POST "http://localhost:6002/search/image" \
557 508
558 | 参数 | 类型 | 必填 | 默认值 | 描述 | 509 | 参数 | 类型 | 必填 | 默认值 | 描述 |
559 |------|------|------|--------|------| 510 |------|------|------|--------|------|
560 -| `q` | string | ✅ | - | 查询字符串(至少 1 个字符) |  
561 -| `size` | integer | ❌ | 5 | 返回建议数量(1-20) |  
562 -| `types` | string | ❌ | `query` | 建议类型(逗号分隔):`query`, `product`, `category`, `brand` | 511 +| `q` | string | Y | - | 查询字符串(至少 1 个字符) |
  512 +| `size` | integer | N | 5 | 返回建议数量(1-20) |
  513 +| `types` | string | N | `query` | 建议类型(逗号分隔):`query`, `product`, `category`, `brand` |
563 514
564 #### 响应示例 515 #### 响应示例
565 516
@@ -595,8 +546,8 @@ curl "http://localhost:6002/search/suggestions?q=芭&size=5&types=query,product" @@ -595,8 +546,8 @@ curl "http://localhost:6002/search/suggestions?q=芭&size=5&types=query,product"
595 546
596 | 参数 | 类型 | 必填 | 默认值 | 描述 | 547 | 参数 | 类型 | 必填 | 默认值 | 描述 |
597 |------|------|------|--------|------| 548 |------|------|------|--------|------|
598 -| `q` | string | ✅ | - | 搜索查询(至少 2 个字符) |  
599 -| `size` | integer | ❌ | 5 | 返回结果数量(1-20) | 549 +| `q` | string | Y | - | 搜索查询(至少 2 个字符) |
  550 +| `size` | integer | N | 5 | 返回结果数量(1-20) |
600 551
601 #### 请求示例 552 #### 请求示例
602 553