Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api sql调用思源如何保持内容结构和高效 #12260

Closed
3 tasks done
sunk926 opened this issue Aug 16, 2024 · 8 comments
Closed
3 tasks done

api sql调用思源如何保持内容结构和高效 #12260

sunk926 opened this issue Aug 16, 2024 · 8 comments
Assignees

Comments

@sunk926
Copy link

sunk926 commented Aug 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

目前需要将思源中的特定标签内容通过api导入到知识库系统,但是只能 先获取到标题,然后再通过标题递归出所有的子块,包括多层级的块,再用 getChildBlocks 获取到顺序id,最后再根据获取到的id进行对sql获取的内容排序.

Expected result

这样的效率太低了,每次取一条信息,要递归sql查询很多次,而且容易出错..有没有高效一点的方法,就指定某个id就可以直接取出这个id下面所有层级的内容. 同时内容顺序结构保持不变.其实就是类似 getChildBlocks ,不光是取出id,还有content,markdown.

Screenshot or screen recording presentation

No response

Version environment

- Version: 
- Operating System: 
- Browser (if used):

Log file

1

More information

No response

@88250
Copy link
Member

88250 commented Aug 16, 2024

可以试试这个接口 /api/block/getBlockTreeInfos #11311

@sunk926
Copy link
Author

sunk926 commented Aug 16, 2024

可以试试这个接口 /api/block/getBlockTreeInfos #11311

感谢, api文档里面没这个接口.可是我发现这个没getChildBlocks 好用,getChildBlocks能直接获取到一个块下面的所有子块..目前的问题就是 还需要通过api遍历所有子块,内容一多效率就很老火.
比如这样的:

<h1>
  11
  <h2> 
   22
   <h2>
    <h3>
     333

@88250 88250 self-assigned this Aug 16, 2024
@88250
Copy link
Member

88250 commented Aug 16, 2024

我大概明白了,我们改进一下 getChildBlocks #8249 吧,加入返回 content 和 markdown 字段。

@88250
Copy link
Member

88250 commented Aug 16, 2024

这个改动就不拉进版本了。
This change will not be included in the version.

@sunk926
Copy link
Author

sunk926 commented Aug 16, 2024

这个改动就不拉进版本了。 This change will not be included in the version.

嗯嗯,👍👍👍

@88250
Copy link
Member

88250 commented Aug 16, 2024

稍后会发布一个 dev 版,请帮忙测试。

@sunk926
Copy link
Author

sunk926 commented Aug 17, 2024

稍后会发布一个 dev 版,请帮忙测试。
测试了下,没什么问题,顺序都是对得上的

@88250
Copy link
Member

88250 commented Aug 17, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants