Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
```kotlin title="Kotlin"
import dev.kreuzberg.*
import java.util.concurrent.atomic.AtomicInteger
class PdfMetadataExtractor : IPostProcessor {
private val processed = AtomicInteger(0)
override fun name(): String = "pdf-metadata-extractor"
override fun version(): String = "1.0.0"
override fun process(result: ExtractionResult, config: ExtractionConfig) {
if (result.mimeType() != "application/pdf") return
val count = processed.incrementAndGet()
val metadata: Metadata = result.metadata()
// Metadata is an immutable record — read PDF metadata fields rather
// than mutate. Reporting via stdout/log keeps the snippet honest.
println(
"[pdf-metadata] #$count title=${metadata.title()} authors=${metadata.authors()}",
)
}
override fun processing_stage(): ProcessingStage = ProcessingStage.Late
override fun should_process(
_result: ExtractionResult,
_config: ExtractionConfig,
): Boolean = _result.mimeType() == "application/pdf"
override fun estimated_duration_ms(_result: ExtractionResult): Long = 2L
override fun priority(): Int = 25
}
fun registerPdfMetadataExtractor() {
PostProcessorBridge.registerPostProcessor(PdfMetadataExtractor())
}
```