Examples of UpdateRequest


Examples of org.apache.solr.client.solrj.request.UpdateRequest

      try
      {
        try
        {
          // Do the operation!
          UpdateRequest updateRequest = new UpdateRequest(postUpdateAction + "?commit=true");
          UpdateResponse response = updateRequest.process(solrServer);
          //UpdateResponse response = solrServer.commit();
        }
        catch (InterruptedIOException ioe)
        {
          return;
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

        // Do the operation!
        long fullStartTime = System.currentTimeMillis();
        // Open a socket to ingest, and to the response stream to get the post result
        try
        {
          UpdateResponse response = new UpdateRequest(postRemoveAction).deleteById(documentURI).process(solrServer);
           
          // Success
          activityStart = new Long(fullStartTime);
          activityCode = "OK";
          activityDetails = null;
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

      try
      {
        try
        {
          // Do the operation!
          UpdateRequest updateRequest = new UpdateRequest(postUpdateAction + "?commit=true");
          UpdateResponse response = updateRequest.process(solrServer);
          //UpdateResponse response = solrServer.commit();
        }
        catch (InterruptedIOException ioe)
        {
          return;
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

    // common local zk hosts
    private final String[] zkHosts = new String[]{"localhost:9983"};

    private boolean canCreateCollections(String host) throws Exception {
        UpdateRequest req = new UpdateRequest("/admin/collections");
        req.setParam("action", "CREATE");
        String solrCollection = "solr_" + System.nanoTime();
        req.setParam("name", solrCollection);
        req.setParam("numShards", "2");
        req.setParam("replicationFactor", "2");
        req.setParam("collection.configName", "myconf");
        CloudSolrServer cloudSolrServer = new CloudSolrServer(host);
        NamedList<Object> request = cloudSolrServer.request(req);
//        cloudSolrServer.shutdown();
        return request != null && request.get("success") != null;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

          LOG.info("SolrDeleteDuplicates: deleting " + numDeletes + " duplicates");
          updateRequest.process(solr);
        } catch (SolrServerException e) {
          throw new IOException(e);
        }
        updateRequest = new UpdateRequest();
        numDeletes = 0;
      }
    }
  }
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

                updateRequest.process(solrServer);
            }

        } else if (body instanceof SolrInputDocument) {

            UpdateRequest updateRequest = new UpdateRequest(getRequestHandler());
            updateRequest.add((SolrInputDocument) body);

            if (isStreaming) {
                updateRequest.process(streamingSolrServer);
            } else {
                updateRequest.process(solrServer);
            }

        } else {

            boolean hasSolrHeaders = false;
            Map<String, Object> headers = exchange.getIn().getHeaders();
            for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) {
                if (entry.getKey().startsWith(SolrConstants.FIELD)) {
                    hasSolrHeaders = true;
                    break;
                }
            }

            if (hasSolrHeaders) {

                UpdateRequest updateRequest = new UpdateRequest(getRequestHandler());

                SolrInputDocument doc = new SolrInputDocument();
                for (Map.Entry<String, Object> entry : exchange.getIn().getHeaders().entrySet()) {
                    if (entry.getKey().startsWith(SolrConstants.FIELD)) {
                        String fieldName = entry.getKey().substring(SolrConstants.FIELD.length());
                        doc.setField(fieldName, entry.getValue());
                    }
                }
                updateRequest.add(doc);

                if (isStreaming) {
                    updateRequest.process(streamingSolrServer);
                } else {
                    updateRequest.process(solrServer);
                }

            } else if (body instanceof String) {

                String bodyAsString = (String) body;
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

            ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
            SolrZkClient zkClient = zkStateReader.getZkClient();
            if (zkClient.isConnected() && !zkClient.exists("/configs/" + solrCollection, false)) {
                File dir = new File(solrConfDir != null ? solrConfDir : getClass().getResource("/solr-oak-conf").getFile());
                ZkController.uploadConfigDir(zkClient, dir, solrCollection);
                UpdateRequest req = new UpdateRequest("/admin/collections");
                req.setParam("action", "CREATE");
                req.setParam("numShards", String.valueOf(solrShardsNo));
                req.setParam("replicationFactor", String.valueOf(solrReplicationFactor));
                req.setParam("collection.configName", solrCollection);
                req.setParam("name", solrCollection);
                cloudSolrServer.request(req);
            }
        } catch (Exception e) {
            log.warn("could not create collection {}", solrCollection);
            throw new SolrServerException(e);
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

    // common local zk hosts
    private final String[] zkHosts = new String[]{"localhost:9983"};

    private boolean canCreateCollections(String host) throws Exception {
        UpdateRequest req = new UpdateRequest("/admin/collections");
        req.setParam("action", "CREATE");
        String solrCollection = "solr_" + System.nanoTime();
        req.setParam("name", solrCollection);
        req.setParam("numShards", "2");
        req.setParam("replicationFactor", "2");
        req.setParam("collection.configName", "myconf");
        CloudSolrServer cloudSolrServer = new CloudSolrServer(host);
        NamedList<Object> request = cloudSolrServer.request(req);
        return request != null && request.get("success") != null;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

            ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
            SolrZkClient zkClient = zkStateReader.getZkClient();
            if (zkClient.isConnected() && !zkClient.exists("/configs/" + solrCollection, false)) {
                File dir = new File(solrConfDir != null ? solrConfDir : getClass().getResource("/solr-oak-conf").getFile());
                ZkController.uploadConfigDir(zkClient, dir, solrCollection);
                UpdateRequest req = new UpdateRequest("/admin/collections");
                req.setParam("action", "CREATE");
                req.setParam("numShards", String.valueOf(solrShardsNo));
                req.setParam("replicationFactor", String.valueOf(solrReplicationFactor));
                req.setParam("collection.configName", solrCollection);
                req.setParam("name", solrCollection);
                cloudSolrServer.request(req);
            }
        } catch (Exception e) {
            log.warn("could not create collection {}", solrCollection);
            throw new SolrServerException(e);
View Full Code Here

Examples of org.apache.solr.client.solrj.request.UpdateRequest

                LOG.info("Indexing " + Integer.toString(inputDocs.size())
                        + " documents");
                LOG.info("Deleting " + Integer.toString(numDeletes)
                        + " documents");
                numDeletes = 0;
                UpdateRequest req = new UpdateRequest();
                req.add(inputDocs);
                req.setParams(params);
                req.process(solr);
            } catch (final SolrServerException e) {
                throw makeIOException(e);
            }
            inputDocs.clear();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.