Browse Source

测试搜索。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.3.2^2
zouap 4 years ago
parent
commit
31ab2415d7
1 changed files with 4 additions and 0 deletions
  1. +4
    -0
      routers/search.go

+ 4
- 0
routers/search.go View File

@@ -47,12 +47,16 @@ func Search(ctx *context.Context) {
res, err := client.Search(TableName+"-es-index").Query(boolQ).Sort("updated_unix", false).Do(ctx.Req.Context())
if err == nil {
ctx.JSON(200, res)
} else {
log.Info("query es error," + err.Error())
}
} else {
log.Info("query all content.")
res, err := client.Search(TableName + "-es-index").Do(ctx.Req.Context())
if err == nil {
ctx.JSON(200, res)
} else {
log.Info("query es error," + err.Error())
}
}
}

Loading…
Cancel
Save