You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/supply/setting/opensearch.go

41 lines
929 B

2 years ago
package setting
import (
"context"
"git.oa00.com/supply-chain/service/client"
)
type opensearch struct {
}
type ArgsOpensearchToken struct {
Analyzer string
Text string
}
type TokenOpensearchItem struct {
Token string `json:"token"`
StartOffset int `json:"startOffset"`
EndOffset int `json:"endOffset"`
Type string `json:"type"`
Position int `json:"position"`
}
// Analyzer @Title 分词测试
func (o *opensearch) Analyzer(ctx context.Context, args ArgsOpensearchToken) (result []TokenOpensearchItem, err error) {
xClient, err := client.GetClient(o)
if err != nil {
return
}
err = xClient.Call(ctx, "Analyzer", args, &result)
return
}
// IndicesRefresh @Title 刷新索引
func (o *opensearch) IndicesRefresh(ctx context.Context) error {
xClient, err := client.GetClient(o)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "IndicesRefresh", 0, &reply)
}