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

This commit is contained in:
Vanessa 2023-10-25 10:10:16 +08:00
commit 5047d414e3
4 changed files with 195 additions and 23 deletions

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20230805232134-3d6mx2k",
"title": "Search asset content",
"updated": "20230903112423"
"updated": "20231025095559"
},
"Children": [
{
@ -205,7 +205,7 @@
},
{
"Type": "NodeText",
"Data": ":"
"Data": ":"
}
]
},
@ -215,27 +215,82 @@
"ListData": {},
"Properties": {
"id": "20230903112419-45ps71g",
"updated": "20230903112423"
"updated": "20231025095559"
},
"Children": [
{
"ID": "20230903112419-t7iom3o",
"ID": "20231025095236-xu5tp9f",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230903112419-t7iom3o",
"updated": "20230903112423"
"id": "20231025095236-xu5tp9f"
},
"Children": [
{
"ID": "20230903112419-8gd73ed",
"ID": "20231025095236-18gmg9h",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112419-8gd73ed",
"updated": "20230903112423"
"id": "20231025095236-18gmg9h",
"updated": "20231025095237"
},
"Children": [
{
"Type": "NodeText",
"Data": "Text files larger than 4MB are not supported"
}
]
}
]
},
{
"ID": "20231025095244-lpf6spo",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095244-lpf6spo",
"updated": "20231025095559"
},
"Children": [
{
"ID": "20231025095244-m8ut4h2",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095244-m8ut4h2",
"updated": "20231025095559"
},
"Children": [
{
"Type": "NodeText",
"Data": "PDFs larger than 128MB or 1024 pages are not supported"
}
]
}
]
},
{
"ID": "20231025095259-wrlui2y",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095259-wrlui2y",
"updated": "20231025095300"
},
"Children": [
{
"ID": "20231025095259-cm641sa",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095259-cm641sa",
"updated": "20231025095300"
},
"Children": [
{

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20230805230218-aea8icj",
"title": "搜索资源文件内容",
"updated": "20230903112313"
"updated": "20231025095556"
},
"Children": [
{
@ -207,7 +207,7 @@
},
{
"Type": "NodeText",
"Data": ""
"Data": ""
}
]
},
@ -217,27 +217,82 @@
"ListData": {},
"Properties": {
"id": "20230903112243-pwm33kc",
"updated": "20230903112313"
"updated": "20231025095556"
},
"Children": [
{
"ID": "20230903112244-2ye7sed",
"ID": "20231025095048-l224arr",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230903112244-2ye7sed",
"updated": "20230903112313"
"id": "20231025095048-l224arr"
},
"Children": [
{
"ID": "20230903112244-ux44rel",
"ID": "20231025095048-u6ge0ue",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112244-ux44rel",
"updated": "20230903112313"
"id": "20231025095048-u6ge0ue",
"updated": "20231025095053"
},
"Children": [
{
"Type": "NodeText",
"Data": "不支持大于 4MB 的文本文件"
}
]
}
]
},
{
"ID": "20231025095053-a0quwv1",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095053-a0quwv1",
"updated": "20231025095556"
},
"Children": [
{
"ID": "20231025095053-ee3etgb",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095053-ee3etgb",
"updated": "20231025095556"
},
"Children": [
{
"Type": "NodeText",
"Data": "不支持大于 128MB 或 1024 页的 PDF"
}
]
}
]
},
{
"ID": "20231025095306-wro7c1x",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095306-wro7c1x",
"updated": "20231025095306"
},
"Children": [
{
"ID": "20231025095306-6gcc6ba",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095306-6gcc6ba",
"updated": "20231025095306"
},
"Children": [
{

View file

@ -5,7 +5,7 @@
"Properties": {
"id": "20230805232920-5fdco36",
"title": "搜索資源文件內容",
"updated": "20230903112449"
"updated": "20231025095553"
},
"Children": [
{
@ -220,9 +220,64 @@
"ListData": {},
"Properties": {
"id": "20230903112449-mq7jbfe",
"updated": "20230903112449"
"updated": "20231025095553"
},
"Children": [
{
"ID": "20231025095311-dviybbz",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095311-dviybbz"
},
"Children": [
{
"ID": "20231025095311-uri9j00",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095311-uri9j00",
"updated": "20231025095316"
},
"Children": [
{
"Type": "NodeText",
"Data": "不支援大於 4MB 的文字文件"
}
]
}
]
},
{
"ID": "20231025095319-kupw6kw",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20231025095319-kupw6kw",
"updated": "20231025095553"
},
"Children": [
{
"ID": "20231025095319-egfy5yi",
"Type": "NodeParagraph",
"Properties": {
"id": "20231025095319-egfy5yi",
"updated": "20231025095553"
},
"Children": [
{
"Type": "NodeText",
"Data": "不支援大於 128MB 或 1024 頁的 PDF"
}
]
}
]
},
{
"ID": "20230903112449-ihee8jo",
"Type": "NodeListItem",
@ -232,7 +287,7 @@
},
"Properties": {
"id": "20230903112449-ihee8jo",
"updated": "20230903112449"
"updated": "20231025095336"
},
"Children": [
{
@ -240,12 +295,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112449-v6wir40",
"updated": "20230903112449"
"updated": "20231025095336"
},
"Children": [
{
"Type": "NodeText",
"Data": "Android/iOS 端不支持 PDF 資源文件內容搜索"
"Data": "Android/iOS 端不支援 PDF 資源檔案內容搜索"
}
]
}

View file

@ -480,6 +480,7 @@ func NewAssetsSearcher() *AssetsSearcher {
const (
TxtAssetContentMaxSize = 1024 * 1024 * 4
PDFAssetContentMaxPage = 1024
PDFAssetContentMaxSize = 1024 * 1024 * 128
)
type AssetParseResult struct {
@ -828,6 +829,12 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
return
}
if PDFAssetContentMaxSize < len(pdfData) {
// PDF files larger than 128MB are not included in asset file content searching https://github.com/siyuan-note/siyuan/issues/9500
logging.LogWarnf("ignore large PDF asset [%s] with [%s]", absPath, humanize.Bytes(uint64(len(pdfData))))
return
}
// next setup worker pool for processing PDF pages
pages := make(chan *pdfPage, pc.PageCount)
results := make(chan *pdfTextResult, pc.PageCount)