|
|
|
@@ -394,6 +394,8 @@ func searchDataSet(ctx *context.Context, TableName string, Key string, Page int, |
|
|
|
boolQ.Should(nameQuery, descQuery, categoryQuery, fileNameQuery) |
|
|
|
res, err := client.Search(TableName).Query(boolQ).Sort(SortBy, ascending).From((Page - 1) * PageSize).Size(PageSize).Highlight(queryHighlight("title", "description", "file_name", "category")).Do(ctx.Req.Context()) |
|
|
|
if err == nil { |
|
|
|
searchJson, _ := json.Marshal(res) |
|
|
|
log.Info("searchJson=" + string(searchJson)) |
|
|
|
result := makeDatasetResult(res, Key, OnlyReturnNum) |
|
|
|
ctx.JSON(200, result) |
|
|
|
} else { |
|
|
|
@@ -404,6 +406,8 @@ func searchDataSet(ctx *context.Context, TableName string, Key string, Page int, |
|
|
|
//搜索的属性要指定{"timestamp":{"unmapped_type":"date"}} |
|
|
|
res, err := client.Search(TableName).Sort(SortBy, ascending).From((Page - 1) * PageSize).Size(PageSize).Do(ctx.Req.Context()) |
|
|
|
if err == nil { |
|
|
|
searchJson, _ := json.Marshal(res) |
|
|
|
log.Info("searchJson=" + string(searchJson)) |
|
|
|
result := makeDatasetResult(res, "", OnlyReturnNum) |
|
|
|
ctx.JSON(200, result) |
|
|
|
} else { |
|
|
|
|