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

This commit is contained in:
Vanessa 2023-02-16 15:32:19 +08:00
commit 9ac2240120
5 changed files with 19 additions and 13 deletions

View file

@ -242,7 +242,7 @@ export const query = {
<div class="b3-label__text">${window.siyuan.languages.searchLimit2}</div>
</div>
<span class="fn__space"></span>
<input class="b3-text-field fn__flex-center fn__size200" id="limit" type="number" min="1" max="10240" value="${window.siyuan.config.search.limit}">
<input class="b3-text-field fn__flex-center fn__size200" id="limit" type="number" min="32" max="10240" value="${window.siyuan.config.search.limit}">
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">

View file

@ -209,8 +209,8 @@ func setSearch(c *gin.Context) {
return
}
if 1 > s.Limit {
s.Limit = 64
if 32 > s.Limit {
s.Limit = 32
}
oldCaseSensitive := model.Conf.Search.CaseSensitive

View file

@ -293,6 +293,9 @@ func InitConf() {
if 1 > Conf.Search.Limit {
Conf.Search.Limit = 64
}
if 32 > Conf.Search.Limit {
Conf.Search.Limit = 32
}
if 1 > Conf.Search.BacklinkMentionKeywordsLimit {
Conf.Search.BacklinkMentionKeywordsLimit = 512
}

View file

@ -113,23 +113,26 @@ func BuildTreeGraph(id, query string) (boxID string, nodes []*GraphNode, links [
rootIDs = append(rootIDs, rootDef.ID)
}
sqlRootRefBlocks := sql.QueryRefRootBlocksByDefRootIDs(rootIDs)
for defRootID, sqlRefBlocks := range sqlRootRefBlocks {
sqlRefBlocks := sql.QueryRefRootBlocksByDefRootIDs(rootIDs)
for defRootID, sqlRefBlocks := range sqlRefBlocks {
rootBlock := getBlockIn(rootDefBlocks, defRootID)
if nil == rootBlock {
continue
}
refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0)
rootBlock.Refs = append(rootBlock.Refs, refBlocks...)
}
// 按定义处理
sqlRootRefBlocks = sql.QueryRefRootBlocksByDefRootIDs([]string{rootID})
for _, sqlRefBlocks := range sqlRootRefBlocks {
blocks = append(blocks, rootBlock)
refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0)
rootBlock.Refs = append(rootBlock.Refs, refBlocks...)
blocks = append(blocks, refBlocks...)
}
// 按定义处理
sqlRefBlocks = sql.QueryRefRootBlocksByDefRootIDs([]string{rootID})
for _, sqlRefBlocks := range sqlRefBlocks {
blocks = append(blocks, rootBlock)
refBlocks := fromSQLBlocks(&sqlRefBlocks, "", 0)
rootBlock.Refs = append(rootBlock.Refs, refBlocks...)
blocks = append(blocks, refBlocks...)
}
}
}

View file

@ -170,7 +170,7 @@ func QueryRefRootBlocksByDefRootIDs(defRootIDs []string) (ret map[string][]*Bloc
}
if nil == ret[defRootID] {
ret[defRootID] = []*Block{}
ret[defRootID] = []*Block{&block}
} else {
ret[defRootID] = append(ret[defRootID], &block)
}