Skip to content

Commit

Permalink
gsc util
Browse files Browse the repository at this point in the history
  • Loading branch information
bujnlc8 committed Nov 9, 2021
1 parent 448ba0c commit b20b5ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion models/gsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func GSCQueryByPage(q string, page_size int64, page_num int64, search_pattern st
sql := fmt.Sprintf("SELECT `id`, work_title, work_author, work_dynasty, "+
"SUBSTRING(content, 1, 50) AS c, audio_id , %s AGAINST ('%s' IN BOOLEAN MODE) AS score FROM gsc WHERE %s "+
"AGAINST ('%s' IN BOOLEAN MODE) ORDER BY audio_id DESC,score DESC LIMIT %d OFFSET %d", matchS, againstS, matchS, againstS, page_size, offset)

rows, err = util.DB.Query(sql)
if err != nil {
return nil, 0, err
Expand Down
2 changes: 2 additions & 0 deletions util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ func MatchStringBySearchPattern(search_pattern string) string {
return "MATCH(content, foreword)"
} else if search_pattern == "author" {
return "MATCH(work_author)"
} else if search_pattern == "dynasty" {
return "MATCH(work_dynasty)"
}
return "MATCH(work_author, work_title, work_dynasty, content)"
}
Expand Down

0 comments on commit b20b5ba

Please sign in to comment.