feat: index the text of attached PDFs

- jz_bm_material_file_texts caches the pdftotext output per file
- the River job jz.bm.extract_material_text extracts and resyncs
- the management multipart attach queues it inside its transaction
- file_texts in the document and a file snippet with its name
This commit is contained in:
Jakub Zych
2026-11-08 20:11:19 +01:00
parent dd13795e6f
commit 412821ec56
21 changed files with 747 additions and 24 deletions

View File

@@ -5,9 +5,11 @@ import (
"embed"
"errors"
"io/fs"
"time"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/bonfire"
"git.golem15.com/golem15/summercms/modules/conga"
"git.golem15.com/golem15/summercms/modules/lagoon"
"git.golem15.com/golem15/summercms/modules/lighthouse"
"git.golem15.com/golem15/summercms/modules/lighthouse/centrifugo"
@@ -108,7 +110,15 @@ func (p *Plugin) MailLayouts() map[string]string { return nil }
func (p *Plugin) Models() []any { return generatedModels() }
func (p *Plugin) Migrations() []*gormigrate.Migration { return generatedMigrations() }
func (p *Plugin) Jobs() []pact.Job { return generatedJobs() }
// Jobs returns the generated jobs and jz.bm.extract_material_text, which
// extracts the text of attached PDFs for search: three attempts, two
// minutes each.
func (p *Plugin) Jobs() []pact.Job {
timeout := conga.Timeout(2 * time.Minute)
return append(generatedJobs(), conga.Job(p.extractMaterialText, conga.MaxAttempts(3), timeout))
}
func (p *Plugin) AdminControllers() []pact.AdminController {
return generatedAdminControllers()
}