List of usage examples for org.apache.solr.update UpdateHandler getUpdateLog
public abstract UpdateLog getUpdateLog();
From source file:lux.solr.SolrDocWriter.java
License:Mozilla Public License
@Override public void write(NodeInfo node, String uri) { UpdateHandler updateHandler = core.getUpdateHandler(); // Create a version of the document for saving to the transaction log, // or for cloud update via HTTP SolrInputDocument solrDoc = new SolrInputDocument(); solrDoc.addField(uriFieldName, uri); if (isCloud()) { // TODO: write as binary, but we need to enable the binary update request writer for this // TinyBinary tinybin = new TinyBinary(((TinyNodeImpl)node).getTree()); // solrDoc.addField(xmlFieldName, tinybin.getByteBuffer().array()); Serializer serializer = xqueryComponent.solrIndexConfig.checkoutSerializer(); try {//from ww w . j a v a 2s. c o m String xmlString = serializer.serializeNodeToString(new XdmNode(node)); solrDoc.addField(xmlFieldName, xmlString); } catch (SaxonApiException e) { throw new LuxException(e); } finally { xqueryComponent.solrIndexConfig.returnSerializer(serializer); } // TODO -- if we can determine this doc only gets added locally?? // solrDoc.addField(xmlFieldName, node); } else if (updateHandler.getUpdateLog() != null) { if (node instanceof TinyNodeImpl) { TinyBinary tinybin = new TinyBinary(((TinyNodeImpl) node).getTree()); solrDoc.addField(xmlFieldName, tinybin.getByteBuffer()); } else { String xml = node.toString(); solrDoc.addField(xmlFieldName, xml); } } if (isCloud()) { writeToCloud(solrDoc, uri); } else { writeLocal(solrDoc, node, uri); } }