mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 /资源 支持搜索未索引的文件 https://github.com/siyuan-note/siyuan/issues/5416
This commit is contained in:
parent
6e02c3e930
commit
4a64f5592f
7 changed files with 96 additions and 33 deletions
|
|
@ -93,22 +93,6 @@ func docTitleImgAsset(root *ast.Node) *Asset {
|
|||
return nil
|
||||
}
|
||||
|
||||
func QueryAssetsByName(name string) (ret []*Asset) {
|
||||
ret = []*Asset{}
|
||||
sqlStmt := "SELECT * FROM assets WHERE name LIKE ? GROUP BY id ORDER BY id DESC LIMIT 32"
|
||||
rows, err := query(sqlStmt, "%"+name+"%")
|
||||
if nil != err {
|
||||
util.LogErrorf("sql query [%s] failed: %s", sqlStmt, err)
|
||||
return
|
||||
}
|
||||
defer rows.Close()
|
||||
for rows.Next() {
|
||||
asset := scanAssetRows(rows)
|
||||
ret = append(ret, asset)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryAssetByHash(hash string) (ret *Asset) {
|
||||
sqlStmt := "SELECT * FROM assets WHERE hash = ?"
|
||||
row := queryRow(sqlStmt, hash)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue