Search in sources :

Example 11 with BinaryResponseParser

use of org.apache.solr.client.solrj.impl.BinaryResponseParser in project lucene-solr by apache.

the class SolrSchemalessExampleTest method createNewSolrClient.

@Override
public SolrClient createNewSolrClient() {
    try {
        // setup the server...
        String url = jetty.getBaseUrl().toString() + "/collection1";
        HttpSolrClient client = getHttpSolrClient(url);
        client.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
        client.setUseMultiPartPost(random().nextBoolean());
        if (random().nextBoolean()) {
            client.setParser(new BinaryResponseParser());
            client.setRequestWriter(new BinaryRequestWriter());
        }
        return client;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : HttpSolrClient(org.apache.solr.client.solrj.impl.HttpSolrClient) BinaryResponseParser(org.apache.solr.client.solrj.impl.BinaryResponseParser) BinaryRequestWriter(org.apache.solr.client.solrj.impl.BinaryRequestWriter)

Example 12 with BinaryResponseParser

use of org.apache.solr.client.solrj.impl.BinaryResponseParser in project lucene-solr by apache.

the class StreamingSolrClients method getSolrClient.

public synchronized SolrClient getSolrClient(final SolrCmdDistributor.Req req) {
    String url = getFullUrl(req.node.getUrl());
    ConcurrentUpdateSolrClient client = solrClients.get(url);
    if (client == null) {
        // NOTE: increasing to more than 1 threadCount for the client could cause updates to be reordered
        // on a greater scale since the current behavior is to only increase the number of connections/Runners when
        // the queue is more than half full.
        client = new ErrorReportingConcurrentUpdateSolrClient(url, httpClient, 100, runnerCount, updateExecutor, true, req);
        // minimize connections created
        client.setPollQueueTime(Integer.MAX_VALUE);
        client.setParser(new BinaryResponseParser());
        client.setRequestWriter(new BinaryRequestWriter());
        Set<String> queryParams = new HashSet<>(2);
        queryParams.add(DistributedUpdateProcessor.DISTRIB_FROM);
        queryParams.add(DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM);
        client.setQueryParams(queryParams);
        solrClients.put(url, client);
    }
    return client;
}
Also used : BinaryResponseParser(org.apache.solr.client.solrj.impl.BinaryResponseParser) BinaryRequestWriter(org.apache.solr.client.solrj.impl.BinaryRequestWriter) ConcurrentUpdateSolrClient(org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient) HashSet(java.util.HashSet)

Aggregations

BinaryResponseParser (org.apache.solr.client.solrj.impl.BinaryResponseParser)12 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)7 BinaryRequestWriter (org.apache.solr.client.solrj.impl.BinaryRequestWriter)4 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)4 Test (org.junit.Test)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ErrorTrackingConcurrentUpdateSolrClient (org.apache.solr.client.solrj.embedded.SolrExampleStreamingTest.ErrorTrackingConcurrentUpdateSolrClient)3 XMLResponseParser (org.apache.solr.client.solrj.impl.XMLResponseParser)3 SolrDocument (org.apache.solr.common.SolrDocument)3 SolrInputDocument (org.apache.solr.common.SolrInputDocument)3 ConcurrentUpdateSolrClient (org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient)2 NoOpResponseParser (org.apache.solr.client.solrj.impl.NoOpResponseParser)2 QueryRequest (org.apache.solr.client.solrj.request.QueryRequest)2 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)2 StringContains.containsString (org.junit.internal.matchers.StringContains.containsString)2 OutputStreamWriter (java.io.OutputStreamWriter)1 StringWriter (java.io.StringWriter)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1