Exemple #1
0
 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));
     }
   }
 }
Exemple #2
0
 public static void addLanguageToDocument(LocalDocument doc, String fieldPrefix, String text) {
   doc.putContentField(fieldPrefix + "language", new LanguageIdentifier(text).getLanguage());
 }
Exemple #3
0
 public static void addTextToDocument(
     LocalDocument doc, String fieldPrefix, StringWriter textData) {
   doc.putContentField(fieldPrefix + "content", textData.toString());
 }