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

@@ -0,0 +1,18 @@
package models
import "time"
// MaterialFileText is the text extracted from one PDF attached to a
// material. An empty Text means the file was extracted and held none (a
// scan or a broken PDF). Truncated is set when the text was cut at the
// extraction cap. The row goes with its file (foreign-key cascade).
type MaterialFileText struct {
FileID uint `gorm:"column:file_id;primaryKey;autoIncrement:false"`
MaterialID uint `gorm:"column:material_id"`
Text string `gorm:"column:text"`
Truncated bool `gorm:"column:truncated"`
ExtractedAt time.Time `gorm:"column:extracted_at"`
}
// TableName is the file text table.
func (MaterialFileText) TableName() string { return "jz_bm_material_file_texts" }