use of org.apache.solr.client.solrj.impl.XMLResponseParser in project lucene-solr by apache.
the class NoOpResponseParserTest method assertResponse.
private void assertResponse(String responseString) throws IOException {
ResponseParser xmlResponseParser = new XMLResponseParser();
NamedList expectedResponse = xmlResponseParser.processResponse(IOUtils.toInputStream(responseString, "UTF-8"), "UTF-8");
List<SolrDocument> documentList = (List<SolrDocument>) expectedResponse.getAll("response").get(0);
assertEquals(1, documentList.size());
SolrDocument solrDocument = documentList.get(0);
assertEquals("1234", String.valueOf(solrDocument.getFieldValue("id")));
}
use of org.apache.solr.client.solrj.impl.XMLResponseParser in project streamline by hortonworks.
the class AmbariInfraWithStormLogSearchTest method setUp.
@Before
public void setUp() throws Exception {
logSearch = new AmbariInfraWithStormLogSearch();
Map<String, Object> conf = new HashMap<>();
buildTestSolrApiUrl = "http://localhost:18886" + TEST_SOLR_API_PATH;
conf.put(AmbariInfraWithStormLogSearch.SOLR_API_URL_KEY, buildTestSolrApiUrl);
conf.put(AmbariInfraWithStormLogSearch.COLLECTION_NAME, TEST_COLLECTION_NAME);
logSearch.init(conf);
// we are doing some hack to change parser, since default wt (javabin) would be faster
// but not good to construct custom result by ourselves
HttpSolrClient solrClient = Deencapsulation.getField(logSearch, "solr");
solrClient.setParser(new XMLResponseParser());
}
use of org.apache.solr.client.solrj.impl.XMLResponseParser in project opencast by opencast.
the class SolrServerFactory method newRemoteInstance.
/**
* Constructor. Prepares solr connection.
*
* @param url
* the connection url to the solr server
*/
public static SolrServer newRemoteInstance(URL url) {
try {
CommonsHttpSolrServer server = new CommonsHttpSolrServer(url);
server.setSoTimeout(5000);
server.setConnectionTimeout(5000);
server.setDefaultMaxConnectionsPerHost(100);
server.setMaxTotalConnections(100);
// defaults to false
server.setFollowRedirects(false);
server.setAllowCompression(true);
// defaults to 0. > 1 not recommended.
server.setMaxRetries(1);
// binary parser is used by default
server.setParser(new XMLResponseParser());
return server;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
Aggregations