Search in sources :

Example 6 with RequestWriter

use of org.apache.solr.client.solrj.request.RequestWriter in project lucene-solr by apache.

the class SolrExampleStreamingTest method createNewSolrClient.

@Override
public SolrClient createNewSolrClient() {
    try {
        // setup the server...
        String url = jetty.getBaseUrl().toString() + "/collection1";
        // smaller queue size hits locks more often
        ConcurrentUpdateSolrClient concurrentClient = new ErrorTrackingConcurrentUpdateSolrClient(url, 2, 5);
        concurrentClient.setParser(new XMLResponseParser());
        concurrentClient.setRequestWriter(new RequestWriter());
        return concurrentClient;
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
}
Also used : RequestWriter(org.apache.solr.client.solrj.request.RequestWriter) ConcurrentUpdateSolrClient(org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient) XMLResponseParser(org.apache.solr.client.solrj.impl.XMLResponseParser)

Example 7 with RequestWriter

use of org.apache.solr.client.solrj.request.RequestWriter in project lucene-solr by apache.

the class SolrExampleXMLTest method createNewSolrClient.

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

Aggregations

RequestWriter (org.apache.solr.client.solrj.request.RequestWriter)7 Test (org.junit.Test)5 HttpSolrClient (org.apache.solr.client.solrj.impl.HttpSolrClient)3 UpdateRequest (org.apache.solr.client.solrj.request.UpdateRequest)3 SolrInputDocument (org.apache.solr.common.SolrInputDocument)3 OutputStream (java.io.OutputStream)2 ArrayList (java.util.ArrayList)2 ByteArrayOutputStream (org.apache.commons.io.output.ByteArrayOutputStream)2 BinaryRequestWriter (org.apache.solr.client.solrj.impl.BinaryRequestWriter)2 XMLResponseParser (org.apache.solr.client.solrj.impl.XMLResponseParser)2 SolrIndexSearcher (org.apache.solr.search.SolrIndexSearcher)2 StringReader (java.io.StringReader)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 ParseException (org.apache.http.ParseException)1 ConcurrentUpdateSolrClient (org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient)1 XMLLoader (org.apache.solr.handler.loader.XMLLoader)1