mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 23:20:13 +01:00
This commit is contained in:
parent
89b0fe579c
commit
49e9b4147f
1 changed files with 16 additions and 15 deletions
|
|
@ -319,21 +319,7 @@ func FullTextSearchBlock(query string, boxes, paths []string, types map[string]b
|
||||||
query = strings.TrimSpace(query)
|
query = strings.TrimSpace(query)
|
||||||
beforeLen := 36
|
beforeLen := 36
|
||||||
var blocks []*Block
|
var blocks []*Block
|
||||||
|
orderByClause := buildOrderBy(orderBy)
|
||||||
var orderByClause string
|
|
||||||
switch orderBy {
|
|
||||||
case 1:
|
|
||||||
orderByClause = "ORDER BY created ASC"
|
|
||||||
case 2:
|
|
||||||
orderByClause = "ORDER BY created DESC"
|
|
||||||
case 3:
|
|
||||||
orderByClause = "ORDER BY updated ASC"
|
|
||||||
case 4:
|
|
||||||
orderByClause = "ORDER BY updated DESC"
|
|
||||||
default:
|
|
||||||
orderByClause = "ORDER BY sort ASC"
|
|
||||||
}
|
|
||||||
|
|
||||||
switch method {
|
switch method {
|
||||||
case 1: // 查询语法
|
case 1: // 查询语法
|
||||||
filter := buildTypeFilter(types)
|
filter := buildTypeFilter(types)
|
||||||
|
|
@ -436,6 +422,21 @@ func buildPathsFilter(paths []string) string {
|
||||||
return builder.String()
|
return builder.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func buildOrderBy(orderBy int) string {
|
||||||
|
switch orderBy {
|
||||||
|
case 1:
|
||||||
|
return "ORDER BY created ASC"
|
||||||
|
case 2:
|
||||||
|
return "ORDER BY created DESC"
|
||||||
|
case 3:
|
||||||
|
return "ORDER BY updated ASC"
|
||||||
|
case 4:
|
||||||
|
return "ORDER BY updated DESC"
|
||||||
|
default:
|
||||||
|
return "ORDER BY sort ASC"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func buildTypeFilter(types map[string]bool) string {
|
func buildTypeFilter(types map[string]bool) string {
|
||||||
s := conf.NewSearch()
|
s := conf.NewSearch()
|
||||||
if err := copier.Copy(s, Conf.Search); nil != err {
|
if err := copier.Copy(s, Conf.Search); nil != err {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue