SolrDocWriter(XQueryComponent xQueryComponent, SolrCore core) { this.core = core; this.xqueryComponent = xQueryComponent; IndexConfiguration indexConfig = xQueryComponent.getSolrIndexConfig().getIndexConfig(); uriFieldName = indexConfig.getFieldName(FieldRole.URI); xmlFieldName = indexConfig.getFieldName(FieldRole.XML_STORE); }
private void deleteCloud(DeleteUpdateCommand cmd) throws IOException { UpdateRequestProcessorChain updateChain = xqueryComponent.getCore().getUpdateProcessingChain("lux-update-chain"); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = UpdateDocCommand.makeSolrRequest(core); UpdateRequestProcessor processor = updateChain.createProcessor(req, rsp); processor.processDelete(cmd); processor.finish(); }
private void writeToCloud(SolrInputDocument solrDoc, String uri) { ArrayList<String> urls = xqueryComponent.getShardURLs(true); LoggerFactory.getLogger(getClass()).debug("writing " + uri + " to cloud at " + urls); SolrQueryResponse rsp = new SolrQueryResponse(); SolrQueryRequest req = UpdateDocCommand.makeSolrRequest(core); ((ModifiableSolrParams) req.getParams()) .add(ShardParams.SHARDS, urls.toArray(new String[urls.size()])); UpdateRequest updateReq = new UpdateRequest(); updateReq.add(solrDoc); UpdateDocCommand cmd = new UpdateDocCommand(req, solrDoc, null, uri); UpdateRequestProcessorChain updateChain = xqueryComponent.getCore().getUpdateProcessingChain("lux-update-chain"); try { UpdateRequestProcessor processor = updateChain.createProcessor(req, rsp); processor.processAdd(cmd); processor.finish(); } catch (IOException e) { throw new LuxException(e); } }
private void writeLocal(SolrInputDocument solrDoc, NodeInfo node, String uri) { XmlIndexer indexer = null; try { indexer = xqueryComponent.getSolrIndexConfig().checkoutXmlIndexer(); try { indexer.index(node, uri); } catch (XMLStreamException e) { throw new LuxException(e); } UpdateDocCommand cmd = new UpdateDocCommand(core, indexer.createLuceneDocument(), uri); cmd.solrDoc = solrDoc; core.getUpdateHandler().addDoc(cmd); } catch (IOException e) { throw new LuxException(e); } finally { if (indexer != null) { xqueryComponent.getSolrIndexConfig().returnXmlIndexer(indexer); } } }
private boolean isCloud() { return xqueryComponent.getCurrentShards() != null; }