The built-in TikaBridge throws an IllegalArgumentException if a null value is given. Although I can understand the thought behind that, here's my situation:
Artificer can store file content either on the filesystem or as a Blob, but that's configurable during runtime. So, my entity fields look something like:
@Lob
@Field
@FieldBridge(impl = ArtificerTikaBridge.class)
public Blob getContent() {
return content;
}
@Field
@FieldBridge(impl = ArtificerTikaBridge.class)
public String getContentPath() {
return contentPath;
}
'content' and 'contentPath' are mutually exclusive. At first, I was hoping to simply use @TikaBridge on both, but you run into the null issue. ArtificerTikaBridge simply does:
@Override
public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
if (value != null) {
super.set(name, value, document, luceneOptions);
}
}
Sure, I could write a custom loader, etc. However, unless you guys think this is an extreme edge case, it might be nice to at least make nullability an option on the annotation.
|