This commit is contained in:
Liang Ding
2022-09-20 11:26:53 +08:00
parent 64bea9c004
commit aaedbb2a7f
5 changed files with 26 additions and 4 deletions

View File

@@ -820,7 +820,7 @@ func tagFromNode(node *ast.Node) (ret string) {
return ast.WalkContinue
}
if ast.NodeTag == n.Type {
if ast.NodeTag == n.Type || n.IsTextMarkType("tag") {
tagBuilder.WriteString("#")
tagBuilder.WriteString(n.Text())
tagBuilder.WriteString("# ")

View File

@@ -81,7 +81,7 @@ func SelectSpansRawStmt(stmt string, limit int) (ret []*Span) {
}
func QueryTagSpansByKeyword(keyword string, limit int) (ret []*Span) {
stmt := "SELECT * FROM spans WHERE type = 'tag' AND content LIKE '%" + keyword + "%'"
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%' AND content LIKE '%" + keyword + "%'"
stmt += " LIMIT " + strconv.Itoa(limit)
rows, err := query(stmt)
if nil != err {
@@ -97,7 +97,7 @@ func QueryTagSpansByKeyword(keyword string, limit int) (ret []*Span) {
}
func QueryTagSpans(p string, limit int) (ret []*Span) {
stmt := "SELECT * FROM spans WHERE type = 'tag'"
stmt := "SELECT * FROM spans WHERE type LIKE '%tag%'"
if "" != p {
stmt += " AND path = '" + p + "'"
}