基本测试完成

This commit is contained in:
suguo.yao 2022-10-15 11:06:04 +08:00
parent 12c533c4b6
commit 7c4209a87a
2 changed files with 34 additions and 9 deletions

View File

@ -1,9 +1,9 @@
# @url=http://admin:123456@192.168.0.254:5678/api
@url=http://admin:123456@192.168.0.254:5678/api
# @url=http://192.168.0.254:5678/api
@url=http://127.0.0.1:5678/api
# @url=http://127.0.0.1:5678/api
###增加/修改索引
POST {{url}}/index?database=default HTTP/1.1
POST {{url}}/index?database=aaa HTTP/1.1
Authorization:
{
@ -15,6 +15,18 @@ Authorization:
}
}
###增加/修改索引 没有database时database is empty"
POST {{url}}/index?database=default HTTP/1.1
Authorization:
{
"text": "北京北三站",
"document": {
"title": "阿森松岛所245",
"number": 226
}
}
###批量增加/修改索引
POST {{url}}/index/batch?database=default HTTP/1.1
@ -55,7 +67,22 @@ POST {{url}}/query HTTP/1.1
}
}
#### 查询索引
#### 查询索引2
POST {{url}}/query?database=default HTTP/1.1
{"query":"北京","page":1,"limit":10,"highlight":{"preTag":"<em style='color:red'>","postTag":"</em>"},"order":"DESC"}
#### 查询状态
GET {{url}}/status HTTP/1.1
#### 创建数据库
GET {{url}}/db/create?database=aaa HTTP/1.1
#### 删除数据库 数据库不存在
GET {{url}}/db/drop?database=aaa HTTP/1.1
#### 显示数据库
GET {{url}}/db/list HTTP/1.1
#### 在线分词
GET {{url}}/word/cut?q=上海和深圳哪个城市幸福指数高 HTTP/1.1

View File

@ -14,8 +14,7 @@ func AddIndex(c *gin.Context) {
}
dbName := c.Query("database")
if dbName == "" {
ResponseErrorWithMsg(c, "database is empty")
return
dbName = "default"
}
err := srv.Index.AddIndex(dbName, document)
if err != nil {
@ -36,8 +35,7 @@ func BatchAddIndex(c *gin.Context) {
dbName := c.Query("database")
if dbName == "" {
ResponseErrorWithMsg(c, "database is empty")
return
dbName = "default"
}
err := srv.Index.BatchAddIndex(dbName, documents)