private void index(boolean isSolrCloud, String collection, Long commitWithin, String contentStreamPath, MultiMapSolrParams requestParams, List<SolrInputDocument> inputDocumentList) throws IOException, SolrServerException,SolrException { UpdateRequest request = new UpdateRequest(contentStreamPath); request.setParams(new ModifiableSolrParams()); // add the extra params, don't use 'set' in case of repeating params Iterator<String> paramNames = requestParams.getParameterNamesIterator(); while (paramNames.hasNext()) { String paramName = paramNames.next(); for (String paramValue : requestParams.getParams(paramName)) { request.getParams().add(paramName, paramValue); } } // specify the collection for SolrCloud if (isSolrCloud) { request.setParam(COLLECTION_PARAM_NAME, collection); } if (commitWithin != null && commitWithin > 0) { request.setParam(COMMIT_WITHIN_PARAM_NAME, commitWithin.toString()); } // if a username and password were provided then pass them for basic auth if (isBasicAuthEnabled()) { request.setBasicAuthCredentials(getUsername(), getPassword()); } request.add(inputDocumentList); UpdateResponse response = request.process(getSolrClient()); getLogger().debug("Got {} response from Solr", new Object[]{response.getStatus()}); inputDocumentList.clear(); }
public UpdateResponse run() throws IOException, SolrServerException { update.process(server); if (immediateCommit) { server.commit(); } return null; } });
public UpdateResponse run() throws IOException, SolrServerException { update.process(server); if (immediateCommit) { server.commit(); } return null; } });
public UpdateResponse commit(SolrClient client, String collection) throws IOException, SolrServerException { if (params == null) params = new ModifiableSolrParams(); params.set(UpdateParams.COMMIT, "true"); return process(client, collection); }
public UpdateResponse add(Collection<SolrInputDocument> docs ) throws SolrServerException, IOException { UpdateRequest req = new UpdateRequest(); req.add(docs); return req.process(this); }
/** * Adds the documents supplied by the given iterator. * * @param docIterator the iterator which returns SolrInputDocument instances * * @return the response from the SolrServer */ public UpdateResponse add(Iterator<SolrInputDocument> docIterator) throws SolrServerException, IOException { UpdateRequest req = new UpdateRequest(); req.setDocIterator(docIterator); return req.process(this); }
public UpdateResponse add(SolrInputDocument doc ) throws SolrServerException, IOException { UpdateRequest req = new UpdateRequest(); req.add(doc); return req.process(this); }
public UpdateResponse commit( boolean waitFlush, boolean waitSearcher ) throws SolrServerException, IOException { return new UpdateRequest().setAction( UpdateRequest.ACTION.COMMIT, waitFlush, waitSearcher ).process( this ); }
public UpdateResponse optimize(boolean waitFlush, boolean waitSearcher, int maxSegments ) throws SolrServerException, IOException { return new UpdateRequest().setAction( UpdateRequest.ACTION.OPTIMIZE, waitFlush, waitSearcher, maxSegments ).process( this ); }
public UpdateResponse deleteById(String id) throws SolrServerException, IOException { return new UpdateRequest().deleteById( id ).process( this ); }
public UpdateResponse deleteById(List<String> ids) throws SolrServerException, IOException { return new UpdateRequest().deleteById( ids ).process( this ); }
protected void indexDocs(List<SolrInputDocument> docs) throws IOException, SolrServerException { if (controlClient != null) { UpdateRequest req = new UpdateRequest(); req.add(docs); req.setParam("CONTROL", "TRUE"); req.process(controlClient); } UpdateRequest ureq = new UpdateRequest(); ureq.add(docs); ureq.process(cloudClient); }
protected UpdateResponse del(SolrClient client, SolrParams params, Object... ids) throws IOException, SolrServerException { UpdateRequest ureq = new UpdateRequest(); ureq.setParams(new ModifiableSolrParams(params)); for (Object id: ids) { ureq.deleteById(id.toString()); } return ureq.process(client); }
@Override public UpdateResponse update(UpdateRequest request) throws TranslatorException { try { request.setCommitWithin(-1); request.setAction(UpdateRequest.ACTION.COMMIT, false, false ); return request.process(this.server); } catch (SolrServerException e) { throw new TranslatorException(e); } catch (IOException e) { throw new TranslatorException(e); } }
protected UpdateResponse add(SolrClient client, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException { UpdateRequest ureq = new UpdateRequest(); ureq.setParams(new ModifiableSolrParams(params)); for (SolrInputDocument sdoc : sdocs) { ureq.add(sdoc); } return ureq.process(client); }
protected UpdateResponse delQ(SolrClient client, SolrParams params, String... queries) throws IOException, SolrServerException { UpdateRequest ureq = new UpdateRequest(); ureq.setParams(new ModifiableSolrParams(params)); for (String q: queries) { ureq.deleteByQuery(q); } return ureq.process(client); }
@Override public UpdateResponse update(UpdateRequest request) throws TranslatorException { try { request.setCommitWithin(-1); request.setAction(UpdateRequest.ACTION.COMMIT, false, false ); return request.process(this.server); } catch (SolrServerException e) { throw new TranslatorException(e); } catch (IOException e) { throw new TranslatorException(e); } }
protected void index_specific(SolrClient client, Object... fields) throws Exception { SolrInputDocument doc = new SolrInputDocument(); for (int i = 0; i < fields.length; i += 2) { doc.addField((String) (fields[i]), fields[i + 1]); } UpdateRequest ureq = new UpdateRequest(); ureq.add(doc); // ureq.setParam("update.chain", DISTRIB_UPDATE_CHAIN); ureq.process(client); // add to control second in case adding to shards fails controlClient.add(doc); }
/** * Add a document. */ public void add(final SolrInputDocument doc) throws SolrServerException, IOException { final UpdateRequest request = new UpdateRequest(); request.add(doc); request.process(this.getServer()); }
/** * Add a document. */ public void add(final SolrInputDocument doc) throws SolrServerException, IOException { final UpdateRequest request = new UpdateRequest(); request.add(doc); request.process(this.getServer()); }