feat: extract file text on every attach path and backfill on reindex

- inline and signed uploads queue the text job in their transaction
- the admin form queues it in the save transaction
- detach resyncs the material (its text row goes by cascade)
- bm:materials-reindex backfills missing PDF texts before each sync
This commit is contained in:
Jakub Zych
2026-11-08 20:16:14 +01:00
parent 412821ec56
commit f841e8ed71
11 changed files with 480 additions and 22 deletions

24
console/export_test.go Normal file
View File

@@ -0,0 +1,24 @@
package console
import (
"context"
"git.golem15.com/golem15/summercms/modules/bonfire"
"gorm.io/gorm"
)
// ReindexRun exposes one reindex walk to the console_test package.
type ReindexRun struct{ r *reindexRun }
// NewReindexRun is a walk with deps' Backfill and the given sync.
func NewReindexRun(deps MaterialsReindexDeps, sync func(id uint) error, out bonfire.Output) ReindexRun {
return ReindexRun{r: &reindexRun{backfill: deps.Backfill, sync: sync, out: out}}
}
// Material runs the per-material step.
func (w ReindexRun) Material(ctx context.Context, db *gorm.DB, id uint) { w.r.material(ctx, db, id) }
// Counts are the run's counters and the tool-missing flag.
func (w ReindexRun) Counts() (synced, failed int, noTool bool) {
return w.r.synced, w.r.failed, w.r.noTool
}