Daniel 2023-09-03 11:30:27 +08:00
parent 291f957944
commit fa7ff32105
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 198 additions and 9 deletions

View file

@ -6,7 +6,7 @@
"icon": "1f387", "icon": "1f387",
"id": "20230805231816-h1z9mpc", "id": "20230805231816-h1z9mpc",
"title": "Function Features", "title": "Function Features",
"updated": "20230805232135" "updated": "20230903112409"
}, },
"Children": [ "Children": [
{ {

View file

@ -5,7 +5,7 @@
"Properties": { "Properties": {
"id": "20230805232134-3d6mx2k", "id": "20230805232134-3d6mx2k",
"title": "Search asset content", "title": "Search asset content",
"updated": "20230821123134" "updated": "20230903112423"
}, },
"Children": [ "Children": [
{ {
@ -185,6 +185,68 @@
] ]
} }
] ]
},
{
"ID": "20230903112419-oart7ii",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112419-oart7ii",
"updated": "20230903112419"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "Note"
},
{
"Type": "NodeText",
"Data": ":"
}
]
},
{
"ID": "20230903112419-45ps71g",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230903112419-45ps71g",
"updated": "20230903112423"
},
"Children": [
{
"ID": "20230903112419-t7iom3o",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230903112419-t7iom3o",
"updated": "20230903112423"
},
"Children": [
{
"ID": "20230903112419-8gd73ed",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112419-8gd73ed",
"updated": "20230903112423"
},
"Children": [
{
"Type": "NodeText",
"Data": "Android/iOS does not support PDF asset content search"
}
]
}
]
}
]
} }
] ]
} }

View file

@ -5,7 +5,7 @@
"Properties": { "Properties": {
"id": "20230805230218-aea8icj", "id": "20230805230218-aea8icj",
"title": "搜索资源文件内容", "title": "搜索资源文件内容",
"updated": "20230821123142" "updated": "20230903112313"
}, },
"Children": [ "Children": [
{ {
@ -187,6 +187,68 @@
] ]
} }
] ]
},
{
"ID": "20230903112236-sl6rni1",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112236-sl6rni1",
"updated": "20230903112241"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "注意"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20230903112243-pwm33kc",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230903112243-pwm33kc",
"updated": "20230903112313"
},
"Children": [
{
"ID": "20230903112244-2ye7sed",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230903112244-2ye7sed",
"updated": "20230903112313"
},
"Children": [
{
"ID": "20230903112244-ux44rel",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112244-ux44rel",
"updated": "20230903112313"
},
"Children": [
{
"Type": "NodeText",
"Data": "Android/iOS 端不支持 PDF 资源文件内容搜索"
}
]
}
]
}
]
} }
] ]
} }

View file

@ -6,7 +6,7 @@
"icon": "1f387", "icon": "1f387",
"id": "20230805232719-04mqbcx", "id": "20230805232719-04mqbcx",
"title": "功能特性", "title": "功能特性",
"updated": "20230805232932" "updated": "20230805232858"
}, },
"Children": [ "Children": [
{ {

View file

@ -5,7 +5,7 @@
"Properties": { "Properties": {
"id": "20230805232920-5fdco36", "id": "20230805232920-5fdco36",
"title": "搜索資源文件內容", "title": "搜索資源文件內容",
"updated": "20230821123201" "updated": "20230903112449"
}, },
"Children": [ "Children": [
{ {
@ -190,6 +190,68 @@
] ]
} }
] ]
},
{
"ID": "20230903112449-zvenj8x",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112449-zvenj8x",
"updated": "20230903112449"
},
"Children": [
{
"Type": "NodeText",
"Data": ""
},
{
"Type": "NodeTextMark",
"TextMarkType": "tag",
"TextMarkTextContent": "注意"
},
{
"Type": "NodeText",
"Data": ""
}
]
},
{
"ID": "20230903112449-mq7jbfe",
"Type": "NodeList",
"ListData": {},
"Properties": {
"id": "20230903112449-mq7jbfe",
"updated": "20230903112449"
},
"Children": [
{
"ID": "20230903112449-ihee8jo",
"Type": "NodeListItem",
"ListData": {
"BulletChar": 42,
"Marker": "Kg=="
},
"Properties": {
"id": "20230903112449-ihee8jo",
"updated": "20230903112449"
},
"Children": [
{
"ID": "20230903112449-v6wir40",
"Type": "NodeParagraph",
"Properties": {
"id": "20230903112449-v6wir40",
"updated": "20230903112449"
},
"Children": [
{
"Type": "NodeText",
"Data": "Android/iOS 端不支持 PDF 資源文件內容搜索"
}
]
}
]
}
]
} }
] ]
} }

View file

@ -553,7 +553,8 @@ func copyTempAsset(absPath string) (ret string) {
filelock.RWLock.Lock() filelock.RWLock.Lock()
defer filelock.RWLock.Unlock() defer filelock.RWLock.Unlock()
ret = filepath.Join(dir, gulu.Rand.String(7)+".docx") ext := filepath.Ext(absPath)
ret = filepath.Join(dir, gulu.Rand.String(7)+ext)
if err := gulu.File.Copy(absPath, ret); nil != err { if err := gulu.File.Copy(absPath, ret); nil != err {
logging.LogErrorf("copy [src=%s, dest=%s] failed: %s", absPath, ret, err) logging.LogErrorf("copy [src=%s, dest=%s] failed: %s", absPath, ret, err)
return return
@ -751,6 +752,11 @@ func (parser *PdfAssetParser) getTextPageWorker(id int, instance pdfium.Pdfium,
// Parse will parse a PDF document using PDFium webassembly module using a worker pool // Parse will parse a PDF document using PDFium webassembly module using a worker pool
func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) { func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
// PDF asset content searching is not supported on mobile platforms
return
}
now := time.Now() now := time.Now()
if !strings.HasSuffix(strings.ToLower(absPath), ".pdf") { if !strings.HasSuffix(strings.ToLower(absPath), ".pdf") {
return return
@ -778,9 +784,6 @@ func (parser *PdfAssetParser) Parse(absPath string) (ret *AssetParseResult) {
cores := runtime.NumCPU() cores := runtime.NumCPU()
if 4 < cores { if 4 < cores {
cores = 4 // Limit memory usage cores = 4 // Limit memory usage
if util.ContainerIOS == util.Container || util.ContainerAndroid == util.Container {
cores = 1 // Reduce the memory usage of PDF asset file content parsing on the mobile https://github.com/siyuan-note/siyuan/issues/9079
}
} }
pool, err := webassembly.Init(webassembly.Config{ pool, err := webassembly.Init(webassembly.Config{