处理字段

This commit is contained in:
2023-11-30 05:23:01 +08:00
parent 72853f7a7f
commit fa2af13e96
4 changed files with 59 additions and 14 deletions

View File

@@ -56,6 +56,7 @@ type SearchData struct {
took int
}
// 获取搜索结果的 ID 列表
func (sd *SearchData) GetIDList() (id_list []string) {
for _, hit := range sd.Hits.Hits {
id_list = append(id_list, hit.ID)
@@ -63,6 +64,7 @@ func (sd *SearchData) GetIDList() (id_list []string) {
return id_list
}
// 获取搜索结果的内容列表
func ElasticsearchSearch(text string) (r *SearchData) {
// 通过字符串构建查询
var buf bytes.Buffer