OCR 搜索按上传时间倒序
This commit is contained in:
@@ -583,7 +583,6 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
"bool": map[string]interface{}{
|
||||
"must": []map[string]interface{}{
|
||||
{
|
||||
//"query_string": map[string]string{"query": "text:" + args.Text},
|
||||
"match_phrase": map[string]string{"text": args.Text},
|
||||
},
|
||||
},
|
||||
@@ -592,8 +591,7 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
"sort": []string{
|
||||
"_score",
|
||||
},
|
||||
//"from": 0,
|
||||
"size": 1000,
|
||||
"size": 2000,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
@@ -613,7 +611,8 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
}
|
||||
|
||||
query = query.Where(goqu.Ex{"web_images.id": goqu.Op{"in": item}}).Select("web_images.id", goqu.L(
|
||||
fmt.Sprintf("ROW_NUMBER() OVER(ORDER BY FIELD(%s, %s))", "web_images.id", regexp.MustCompile(`[\[\]]`).ReplaceAllString(strings.Join(strings.Fields(fmt.Sprint(item)), ", "), "")),
|
||||
//fmt.Sprintf("ROW_NUMBER() OVER(ORDER BY FIELD(%s, %s))", "web_images.id", regexp.MustCompile(`[\[\]]`).ReplaceAllString(strings.Join(strings.Fields(fmt.Sprint(item)), ", "), "")),
|
||||
fmt.Sprintf("ROW_NUMBER() OVER(ORDER BY %s %s)", "web_images.id", "DESC"),
|
||||
).As("row_num"))
|
||||
}
|
||||
|
||||
@@ -637,7 +636,9 @@ func NewSchema(config Config) (graphql.Schema, error) {
|
||||
if p.Args["interest"] != nil {
|
||||
fmt.Println("interest:", p.Args["interest"])
|
||||
user_id := p.Args["interest"].(int)
|
||||
list, err := GetRecommend(user_id, "image")
|
||||
fmt.Println("interest1:", user_id)
|
||||
list, err := GetRecommend(user_id, []string{})
|
||||
fmt.Println("interest2:", list, err)
|
||||
if err != nil {
|
||||
fmt.Println("GetRecommend 获取兴趣推荐失败", err)
|
||||
return map[string]interface{}{"list": []Image{}, "total": 0}, nil
|
||||
|
Reference in New Issue
Block a user