mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🐛 编辑器中输入 # 后标签搜索提示不全 Fix https://github.com/siyuan-note/siyuan/issues/7391
This commit is contained in:
parent
8196052c0d
commit
e08d621da7
3 changed files with 21 additions and 7 deletions
|
|
@ -80,8 +80,23 @@ func SelectSpansRawStmt(stmt string, limit int) (ret []*Span) {
|
|||
return
|
||||
}
|
||||
|
||||
func QueryTagSpansByLabel(label string) (ret []*Span) {
|
||||
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%' AND content LIKE '%" + label + "%' GROUP BY block_id"
|
||||
rows, err := query(stmt)
|
||||
if nil != err {
|
||||
logging.LogErrorf("sql query failed: %s", err)
|
||||
return
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
span := scanSpanRows(rows)
|
||||
ret = append(ret, span)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryTagSpansByKeyword(keyword string, limit int) (ret []*Span) {
|
||||
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%' AND content LIKE '%" + keyword + "%'"
|
||||
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%' AND content LIKE '%" + keyword + "%' GROUP BY markdown"
|
||||
stmt += " LIMIT " + strconv.Itoa(limit)
|
||||
rows, err := query(stmt)
|
||||
if nil != err {
|
||||
|
|
@ -96,12 +111,11 @@ func QueryTagSpansByKeyword(keyword string, limit int) (ret []*Span) {
|
|||
return
|
||||
}
|
||||
|
||||
func QueryTagSpans(p string, limit int) (ret []*Span) {
|
||||
func QueryTagSpans(p string) (ret []*Span) {
|
||||
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%'"
|
||||
if "" != p {
|
||||
stmt += " AND path = '" + p + "'"
|
||||
}
|
||||
stmt += " LIMIT " + strconv.Itoa(limit)
|
||||
rows, err := query(stmt)
|
||||
if nil != err {
|
||||
logging.LogErrorf("sql query failed: %s", err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue