CommonsHttpSolrServer server =... server.setParser(new BinaryResponseParser());
CommonsHttpSolrServer commonsHttpSolrServer = new CommonsHttpSolrServer("solr_path_url"); commonsHttpSolrServer.setParser(new XMLResponseParser()); ModifiableSolrParams params = new ModifiableSolrParams(); // Specify the Request handler params.add("qt", "dismax_request_handler"); params.add("q", "query_string"); QueryResponse response = commonsHttpSolrServer.query(params);
server.setParser(new XMLResponseParser());
server.setParser(new XMLResponseParser());
/** * 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); server.setFollowRedirects(false); // defaults to false server.setAllowCompression(true); server.setMaxRetries(1); // defaults to 0. > 1 not recommended. server.setParser(new XMLResponseParser()); // binary parser is used by default return server; } catch (Exception e) { throw new RuntimeException(e); } }