fix dc:date in mediawikiimporter/document.writexml to use lastmodified

pull/37/head
reger 9 years ago
parent 14803d58cd
commit 6b7c10cef8

@ -765,7 +765,7 @@ dc_rights
return this.crawldepth; return this.crawldepth;
} }
public void writeXML(final Writer os, final Date date) throws IOException { public void writeXML(final Writer os) throws IOException {
os.write("<record>\n"); os.write("<record>\n");
final String title = dc_title(); final String title = dc_title();
if (title != null && title.length() > 0) os.write("<dc:title><![CDATA[" + title + "]]></dc:title>\n"); if (title != null && title.length() > 0) os.write("<dc:title><![CDATA[" + title + "]]></dc:title>\n");
@ -783,7 +783,7 @@ dc_rights
} }
final String language = dc_language(); final String language = dc_language();
if (language != null && language.length() > 0) os.write("<dc:language>" + dc_language() + "</dc:language>\n"); if (language != null && language.length() > 0) os.write("<dc:language>" + dc_language() + "</dc:language>\n");
os.write("<dc:date>" + ISO8601Formatter.FORMATTER.format(date) + "</dc:date>\n"); os.write("<dc:date>" + ISO8601Formatter.FORMATTER.format(getLastModified()) + "</dc:date>\n");
if (this.lon != 0.0 && this.lat != 0.0) os.write("<geo:Point><geo:long>" + this.lon +"</geo:long><geo:lat>" + this.lat + "</geo:lat></geo:Point>\n"); if (this.lon != 0.0 && this.lat != 0.0) os.write("<geo:Point><geo:long>" + this.lon +"</geo:long><geo:lat>" + this.lat + "</geo:lat></geo:Point>\n");
os.write("</record>\n"); os.write("</record>\n");
} }
@ -793,7 +793,7 @@ dc_rights
final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final ByteArrayOutputStream baos = new ByteArrayOutputStream();
try { try {
final Writer osw = new OutputStreamWriter(baos, "UTF-8"); final Writer osw = new OutputStreamWriter(baos, "UTF-8");
writeXML(osw, this.lastModified); writeXML(osw);
osw.close(); osw.close();
return UTF8.String(baos.toByteArray()); return UTF8.String(baos.toByteArray());
} catch (final UnsupportedEncodingException e1) { } catch (final UnsupportedEncodingException e1) {

@ -353,7 +353,7 @@ public class DCEntry extends MultiMapSolrParams {
public void writeXML(OutputStreamWriter os) throws IOException { public void writeXML(OutputStreamWriter os) throws IOException {
Document doc = document(); Document doc = document();
if (doc != null) { if (doc != null) {
doc.writeXML(os, this.getDate()); doc.writeXML(os);
} }
} }
} }

@ -523,7 +523,7 @@ public class MediawikiImporter extends Thread implements Importer {
} }
} }
public void writeXML(final OutputStreamWriter os) throws IOException { public void writeXML(final OutputStreamWriter os) throws IOException {
this.document.writeXML(os, new Date()); this.document.writeXML(os);
} }
} }
@ -710,7 +710,7 @@ public class MediawikiImporter extends Thread implements Importer {
this.osw.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + SurrogateReader.SURROGATES_MAIN_ELEMENT_OPEN + "\n"); this.osw.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + SurrogateReader.SURROGATES_MAIN_ELEMENT_OPEN + "\n");
} }
ConcurrentLog.info("WIKITRANSLATION", "[CONSUME] Title: " + record.title); ConcurrentLog.info("WIKITRANSLATION", "[CONSUME] Title: " + record.title);
record.document.writeXML(this.osw, new Date()); record.document.writeXML(this.osw);
this.rc++; this.rc++;
if (this.rc >= 10000) { if (this.rc >= 10000) {
this.osw.write("</surrogates>\n"); this.osw.write("</surrogates>\n");

Loading…
Cancel
Save