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,34 @@
```java title="Java"
import dev.kreuzberg.Kreuzberg;
import dev.kreuzberg.ExtractionResult;
import dev.kreuzberg.Validator;
import dev.kreuzberg.ValidationException;
import dev.kreuzberg.KreuzbergException;
import java.io.IOException;
public class MinLengthValidatorExample {
public static void main(String[] args) {
int minLength = 100;
Validator minLengthValidator = result -> {
if (result.getContent().length() < minLength) {
throw new ValidationException(
"Content too short: " + result.getContent().length() +
" < " + minLength
);
}
};
try {
Kreuzberg.registerValidator("min-length", minLengthValidator, 100);
ExtractionResult result = Kreuzberg.extractFile("document.pdf");
System.out.println("Validation passed!");
} catch (ValidationException e) {
System.err.println("Validation failed: " + e.getMessage());
} catch (IOException | KreuzbergException e) {
e.printStackTrace();
}
}
}
```