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:
@@ -115,7 +115,8 @@ func (h *Handlers) AttachMaterialFiles(w http.ResponseWriter, r *http.Request) {
|
||||
h.writeMaterialDetail(w, r, db, m.ID, http.StatusCreated)
|
||||
}
|
||||
|
||||
// storeParts stores and binds every "file" part in one transaction. A
|
||||
// storeParts stores and binds every "file" part in one transaction and
|
||||
// queues the file text job in it. A
|
||||
// refusal (no file, too many, a type or size attach.Store turns down) is
|
||||
// set in *refusal and rolls back; the returned keys are the blobs written.
|
||||
func (h *Handlers) storeParts(ctx context.Context, db *gorm.DB, bucket *blob.Bucket, m models.Material, mr *multipart.Reader, refusal *string) ([]string, error) {
|
||||
@@ -153,6 +154,9 @@ func (h *Handlers) storeParts(ctx context.Context, db *gorm.DB, bucket *blob.Buc
|
||||
*refusal = "No file: send at least one multipart part named \"file\"."
|
||||
return errRefused
|
||||
}
|
||||
// The text job joins the transaction: it exists only when the
|
||||
// files commit, and it syncs the material's document.
|
||||
h.MaterialIndex.QueueExtract(ctx, tx, m.ID)
|
||||
return nil
|
||||
})
|
||||
if errors.Is(err, errRefused) {
|
||||
|
||||
Reference in New Issue
Block a user