public static void addMetadataToDocument( LocalDocument doc, String fieldPrefix, Metadata metadata) { for (String name : metadata.names()) { if (metadata.getValues(name).length > 1) { doc.putContentField(fieldPrefix + name, Arrays.asList(metadata.getValues(name))); } else { doc.putContentField(fieldPrefix + name, metadata.get(name)); } } }
public static void addLanguageToDocument(LocalDocument doc, String fieldPrefix, String text) { doc.putContentField(fieldPrefix + "language", new LanguageIdentifier(text).getLanguage()); }
public static void addTextToDocument( LocalDocument doc, String fieldPrefix, StringWriter textData) { doc.putContentField(fieldPrefix + "content", textData.toString()); }