this.setField(doc,FieldConstants.Task_IndexDate,new Date(System.currentTimeMillis()));
}
public void prepare(TaskContext context, XmlTypes xmlTypes,
SolrInputDocument doc, DocInfo info) throws Exception {
TaskStats stats = context.getStats();
String tn = context.getTaskName()+".prepare";
// make the metadata document
long t1 = System.currentTimeMillis();
Document dom = DomUtil.makeDom(info.Xml_Metadata,true);
long t2 = System.currentTimeMillis();
stats.incrementTime(tn+".makeXmlDom",t2-t1);
// interrogate the metadata document
XmlInterrogator interrogator = new XmlInterrogator();
XmlType xmlType = interrogator.interrogate(xmlTypes,dom);
XsltReference xsltReference = xmlType.getToSolrXslt();
XsltTemplate xsltTemplate = XsltTemplates.getCompiledTemplate(xsltReference.getSrc());
info.MetadataType_Key = xmlType.getKey();
info.MetadataType_Identifier = xmlType.getIdentifier();
info.MetadataType_Indexables_Version = xsltReference.getVersion();
long t3 = System.currentTimeMillis();
stats.incrementTime(tn+".interrogateXmlType",t3-t2);
// append fields at the top of the document
this.append(context,doc,info,true,false);
// transform the metadata document to a Solr document
// (this appends fields from the transform)
SolrDocSaxHandler saxHandler = new SolrDocSaxHandler(doc);
DOMSource source = new DOMSource(dom);
SAXResult result = new SAXResult(saxHandler);
xsltTemplate.transform(source,result,null);
long t4 = System.currentTimeMillis();
stats.incrementTime(tn+".transformToSolrDoc",t4-t3);
// append remaining fields
this.append(context,doc,info,false,true);
}