Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-04-18 09:17:11 +08:00
commit f8cfa107a4
11 changed files with 79 additions and 65 deletions

View File

@ -541,7 +541,7 @@
"download": "Download",
"uninstall": "Uninstall",
"all": "All",
"bazaar": "Bazaar",
"bazaar": "Marketplace",
"revolve": "Revolve",
"useDefault": "Open with default program",
"previous": "Previous",

View File

@ -1,5 +1,4 @@
{
"ocrResult": "Texte du résultat OCR",
"ocrResult": "Texto de resultado de OCR",
"reOCR": "Re-OCR",
"continueReview1": "Continuar revisión",
@ -542,7 +541,7 @@
"download": "Descargar",
"uninstall": "Desinstalar",
"all": "Todo",
"bazaar": "Bazar",
"bazaar": "Mercado",
"revolve": "Girar",
"useDefault": "Abrir con el programa por defecto",
"previous": "Anterior",

View File

@ -540,7 +540,7 @@
"download": "Télécharger",
"uninstall": "Désinstaller",
"all": "Tous",
"bazaar": "Bazaar",
"bazaar": "Marché",
"revolve": "Revolve",
"useDefault": "Ouvrir avec le programme par défaut",
"previous": "Précédent",

View File

@ -8,7 +8,7 @@
"title": "Please Start Here",
"title-img": "background-color:#556;background-image: linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(30deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(150deg, #445 12%, transparent 12.5%, transparent 87%, #445 87.5%, #445),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a),linear-gradient(60deg, #99a 25%, transparent 25.5%, transparent 75%, #99a 75%, #99a);background-size:80px 140px;background-position: 0 0, 0 0, 40px 70px, 40px 70px, 0 0, 40px 70px;",
"type": "doc",
"updated": "20230415112503"
"updated": "20230418085821"
},
"Children": [
{
@ -391,7 +391,7 @@
"Type": "NodeSuperBlock",
"Properties": {
"id": "20210528120236-zyh2t7d",
"updated": "20210428231747"
"updated": "20230418085821"
},
"Children": [
{
@ -484,7 +484,7 @@
"Type": "NodeSuperBlock",
"Properties": {
"id": "20210528120308-9wuiyyz",
"updated": "20221114173245"
"updated": "20230418085821"
},
"Children": [
{
@ -515,7 +515,7 @@
"ListData": {},
"Properties": {
"id": "20210317214434-nx9mt0d",
"updated": "20221114173245"
"updated": "20230418085821"
},
"Children": [
{
@ -558,7 +558,7 @@
},
"Properties": {
"id": "20221114173201-njmd9n7",
"updated": "20221114173211"
"updated": "20230418085821"
},
"Children": [
{
@ -566,14 +566,14 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20221114173201-7ilqkuo",
"updated": "20221114173211"
"updated": "20230418085821"
},
"Children": [
{
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://github.com/siyuan-note/bazaar",
"TextMarkTextContent": "Community bazaar"
"TextMarkTextContent": "Community marketplace"
}
]
}

View File

@ -6,7 +6,7 @@
"id": "20200924095938-a9p5450",
"title": "Theme",
"type": "doc",
"updated": "20230417141811"
"updated": "20230418085902"
},
"Children": [
{
@ -482,16 +482,13 @@
"Type": "NodeHeading",
"HeadingLevel": 3,
"Properties": {
"id": "20201225221416-enetgqg"
"id": "20201225221416-enetgqg",
"updated": "20230418085213"
},
"Children": [
{
"Type": "NodeHeadingC8hMarker",
"Data": "### "
},
{
"Type": "NodeText",
"Data": "Community Bazaar"
"Data": "Community Marketplace"
}
]
},
@ -506,7 +503,8 @@
"Num": -1
},
"Properties": {
"id": "20201225221416-chyd31p"
"id": "20201225221416-chyd31p",
"updated": "20230418085223"
},
"Children": [
{
@ -521,7 +519,8 @@
"Num": -1
},
"Properties": {
"id": "20201225221416-fwq6l32"
"id": "20201225221416-fwq6l32",
"updated": "20230418085223"
},
"Children": [
{
@ -529,7 +528,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20210131162108-dtskbvb",
"updated": "20210512161531"
"updated": "20230418085223"
},
"Children": [
{
@ -543,7 +542,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -552,7 +551,7 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
@ -561,16 +560,16 @@
},
{
"Type": "NodeText",
"Data": " - "
"Data": " - "
},
{
"Type": "NodeTextMark",
"TextMarkType": "kbd",
"TextMarkTextContent": "Bazaar"
"TextMarkTextContent": "Marketplace"
},
{
"Type": "NodeText",
"Data": ", browse online themes contributed by community developers"
"Data": ", browse online themes contributed by community developers"
}
]
}
@ -1324,12 +1323,12 @@
"HeadingLevel": 2,
"Properties": {
"id": "20201225222754-u4sica8",
"updated": "20201225222754"
"updated": "20230418085639"
},
"Children": [
{
"Type": "NodeText",
"Data": "Push to theme bazaar"
"Data": "Push to theme marketplace"
}
]
},
@ -1338,7 +1337,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20221114173346-65wavr3",
"updated": "20221114173347"
"updated": "20230418085902"
},
"Children": [
{
@ -1349,7 +1348,7 @@
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://github.com/siyuan-note/bazaar",
"TextMarkTextContent": "Community Bazaar README"
"TextMarkTextContent": "Community marketplace README"
},
{
"Type": "NodeText",

View File

@ -6,7 +6,7 @@
"id": "20200924100110-vcg96wy",
"title": "Icon",
"type": "doc",
"updated": "20221114173333"
"updated": "20230418085910"
},
"Children": [
{
@ -633,7 +633,7 @@
"ListData": {},
"Properties": {
"id": "20210104091404-ewdyw7f",
"updated": "20210104091404"
"updated": "20230418085705"
},
"Children": [
{
@ -817,7 +817,8 @@
"Marker": "Kg=="
},
"Properties": {
"id": "20210104091404-dkmivym"
"id": "20210104091404-dkmivym",
"updated": "20230418085705"
},
"Children": [
{
@ -857,7 +858,8 @@
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20210104091404-rfqjpsy"
"id": "20210104091404-rfqjpsy",
"updated": "20230418085705"
},
"Children": [
{
@ -868,24 +870,22 @@
"Marker": "Kg=="
},
"Properties": {
"id": "20210104091404-08zo0iy"
"id": "20210104091404-08zo0iy",
"updated": "20230418085705"
},
"Children": [
{
"ID": "20210302223515-3y0helv",
"Type": "NodeParagraph",
"Properties": {
"id": "20210302223515-3y0helv"
"id": "20210302223515-3y0helv",
"updated": "20230418085705"
},
"Children": [
{
"Type": "NodeText",
"Data": "Click on "
},
{
"Type": "NodeTextMark",
"TextMarkType": "code"
},
{
"Type": "NodeTextMark",
"TextMarkType": "code",
@ -893,7 +893,7 @@
},
{
"Type": "NodeText",
"Data": " in the upper right corner to import the pictures made in the previous step"
"Data": " in the upper right corner to import the pictures made in the previous step"
}
]
}
@ -1359,12 +1359,12 @@
"HeadingLevel": 2,
"Properties": {
"id": "20210601103837-057w6ot",
"updated": "20210601103841"
"updated": "20230418085722"
},
"Children": [
{
"Type": "NodeText",
"Data": "Push to icon bazaar"
"Data": "Push to icon marketplace"
}
]
},
@ -1373,7 +1373,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20221114173333-rfx8ewj",
"updated": "20221114173333"
"updated": "20230418085910"
},
"Children": [
{
@ -1384,7 +1384,7 @@
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://github.com/siyuan-note/bazaar",
"TextMarkTextContent": "Community Bazaar README"
"TextMarkTextContent": "Community marketplace README"
},
{
"Type": "NodeText",

View File

@ -6,7 +6,7 @@
"id": "20201204184532-3qm9l8n",
"title": "Template snippet",
"type": "doc",
"updated": "20221114173406"
"updated": "20230418085914"
},
"Children": [
{
@ -668,12 +668,13 @@
"Type": "NodeHeading",
"HeadingLevel": 2,
"Properties": {
"id": "20210131162806-sk9tg4q"
"id": "20210131162806-sk9tg4q",
"updated": "20230418085727"
},
"Children": [
{
"Type": "NodeText",
"Data": "Push to template bazaar"
"Data": "Push to template marketplace"
}
]
},
@ -682,7 +683,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20221114173406-3h4imbx",
"updated": "20221114173406"
"updated": "20230418085914"
},
"Children": [
{
@ -693,7 +694,7 @@
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://github.com/siyuan-note/bazaar",
"TextMarkTextContent": "Community Bazaar README"
"TextMarkTextContent": "Community marketplace README"
},
{
"Type": "NodeText",

View File

@ -5,7 +5,7 @@
"Properties": {
"id": "20210824202056-udkf7wg",
"title": "Widgets",
"updated": "20221114173356"
"updated": "20230418085917"
},
"Children": [
{
@ -66,12 +66,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20210824202107-cmsetzk",
"updated": "20211230224119"
"updated": "20230418085759"
},
"Children": [
{
"Type": "NodeText",
"Data": "The widgets are installed through the widget bazaar. After installation, the widgets will be placed in the workspace/widgets folder. In the editor, use the slash menu to trigger the call search. After selecting the widget you need, the widget will be inserted into the document in the form of a widget block."
"Data": "The widgets are installed through the widget marketplace. After installation, the widgets will be placed in the workspace/widgets folder. In the editor, use the slash menu to trigger the call search. After selecting the widget you need, the widget will be inserted into the document in the form of a widget block."
}
]
},
@ -81,12 +81,12 @@
"HeadingLevel": 2,
"Properties": {
"id": "20211222095842-700ar7j",
"updated": "20211222095930"
"updated": "20230418085731"
},
"Children": [
{
"Type": "NodeText",
"Data": "Push to widget bazaar"
"Data": "Push to widget marketplace"
}
]
},
@ -95,7 +95,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20221114173356-q17x02u",
"updated": "20221114173356"
"updated": "20230418085917"
},
"Children": [
{
@ -106,7 +106,7 @@
"Type": "NodeTextMark",
"TextMarkType": "a",
"TextMarkAHref": "https://github.com/siyuan-note/bazaar",
"TextMarkTextContent": "Community Bazaar README"
"TextMarkTextContent": "Community marketplace README"
},
{
"Type": "NodeText",

View File

@ -191,11 +191,16 @@ func searchRefBlock(c *gin.Context) {
return
}
onlyDoc := false
if nil != arg["onlyDoc"] {
onlyDoc = arg["onlyDoc"].(bool)
}
rootID := arg["rootID"].(string)
id := arg["id"].(string)
keyword := arg["k"].(string)
beforeLen := int(arg["beforeLen"].(float64))
blocks, newDoc := model.SearchRefBlock(id, rootID, keyword, beforeLen)
blocks, newDoc := model.SearchRefBlock(id, rootID, keyword, beforeLen, onlyDoc)
ret.Data = map[string]interface{}{
"blocks": blocks,
"newDoc": newDoc,

View File

@ -120,12 +120,12 @@ func searchEmbedBlock(embedBlockID, stmt string, excludeIDs []string, headingMod
return
}
func SearchRefBlock(id, rootID, keyword string, beforeLen int) (ret []*Block, newDoc bool) {
func SearchRefBlock(id, rootID, keyword string, beforeLen int, onlyDoc bool) (ret []*Block, newDoc bool) {
cachedTrees := map[string]*parse.Tree{}
if "" == keyword {
// 查询为空时默认的块引排序规则按最近使用优先 https://github.com/siyuan-note/siyuan/issues/3218
refs := sql.QueryRefsRecent()
refs := sql.QueryRefsRecent(onlyDoc)
for _, ref := range refs {
tree := cachedTrees[ref.DefBlockRootID]
if nil == tree {
@ -157,7 +157,7 @@ func SearchRefBlock(id, rootID, keyword string, beforeLen int) (ret []*Block, ne
return
}
ret = fullTextSearchRefBlock(keyword, beforeLen)
ret = fullTextSearchRefBlock(keyword, beforeLen, onlyDoc)
tmp := ret[:0]
for _, b := range ret {
tree := cachedTrees[b.RootID]
@ -624,7 +624,7 @@ func searchBySQL(stmt string, beforeLen int) (ret []*Block, matchedBlockCount, m
return
}
func fullTextSearchRefBlock(keyword string, beforeLen int) (ret []*Block) {
func fullTextSearchRefBlock(keyword string, beforeLen int, onlyDoc bool) (ret []*Block) {
keyword = gulu.Str.RemoveInvisible(keyword)
if ast.IsNodeIDPattern(keyword) {
@ -646,7 +646,12 @@ func fullTextSearchRefBlock(keyword string, beforeLen int) (ret []*Block) {
"tag, " +
"snippet(" + table + ", 11, '" + search.SearchMarkLeft + "', '" + search.SearchMarkRight + "', '...', 64) AS content, " +
"fcontent, markdown, length, type, subtype, ial, sort, created, updated"
stmt := "SELECT " + projections + " FROM " + table + " WHERE " + table + " MATCH '" + columnFilter() + ":(" + quotedKeyword + ")' AND type IN " + Conf.Search.TypeFilter()
stmt := "SELECT " + projections + " FROM " + table + " WHERE " + table + " MATCH '" + columnFilter() + ":(" + quotedKeyword + ")' AND type"
if onlyDoc {
stmt += " = 'd'"
} else {
stmt += " IN " + Conf.Search.TypeFilter()
}
orderBy := ` order by case
when name = '${keyword}' then 10
when alias = '${keyword}' then 20

View File

@ -335,8 +335,13 @@ func QueryRefIDsByDefID(defID string, containChildren bool) (refIDs, refTexts []
return
}
func QueryRefsRecent() (ret []*Ref) {
rows, err := query("SELECT * FROM refs GROUP BY def_block_id ORDER BY id desc LIMIT 32")
func QueryRefsRecent(onlyDoc bool) (ret []*Ref) {
stmt := "SELECT * FROM refs AS r"
if onlyDoc {
stmt = "SELECT r.* FROM refs AS r, blocks AS b WHERE b.type = 'd' AND b.id = r.def_block_id"
}
stmt += " GROUP BY r.def_block_id ORDER BY r.id DESC LIMIT 32"
rows, err := query(stmt)
if nil != err {
logging.LogErrorf("sql query failed: %s", err)
return