本文整理匯總了Java中org.apache.solr.client.solrj.impl.HttpSolrServer.setParser方法的典型用法代碼示例。如果您正苦於以下問題:Java HttpSolrServer.setParser方法的具體用法?Java HttpSolrServer.setParser怎麽用?Java HttpSolrServer.setParser使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.solr.client.solrj.impl.HttpSolrServer
的用法示例。
在下文中一共展示了HttpSolrServer.setParser方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createNewSolrServer
import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
@Override
public SolrServer createNewSolrServer()
{
try {
// setup the server...
String url = jetty.getBaseUrl().toString() + "/collection1";
HttpSolrServer s = new HttpSolrServer( url );
s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
s.setDefaultMaxConnectionsPerHost(100);
s.setMaxTotalConnections(100);
s.setUseMultiPartPost(random().nextBoolean());
// where the magic happens
s.setParser(new BinaryResponseParser());
s.setRequestWriter(new BinaryRequestWriter());
return s;
}
catch( Exception ex ) {
throw new RuntimeException( ex );
}
}
示例2: createNewSolrServer
import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
@Override
public SolrServer createNewSolrServer() {
try {
// setup the server...
String url = jetty.getBaseUrl().toString() + "/collection1";
HttpSolrServer s = new HttpSolrServer(url);
s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
s.setDefaultMaxConnectionsPerHost(100);
s.setMaxTotalConnections(100);
s.setUseMultiPartPost(random().nextBoolean());
if (random().nextBoolean()) {
s.setParser(new BinaryResponseParser());
s.setRequestWriter(new BinaryRequestWriter());
}
return s;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
示例3: createNewSolrServer
import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
@Override
public SolrServer createNewSolrServer() {
try {
String url = jetty.getBaseUrl().toString() + "/collection1";
HttpSolrServer s = new HttpSolrServer(url);
s.setUseMultiPartPost(random().nextBoolean());
s.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT);
s.setDefaultMaxConnectionsPerHost(100);
s.setMaxTotalConnections(100);
s.setParser(new XMLResponseParser());
s.setRequestWriter(new RequestWriter());
return s;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
示例4: testQueryParse
import org.apache.solr.client.solrj.impl.HttpSolrServer; //導入方法依賴的package包/類
/**
* Parse response from query using NoOpResponseParser.
*/
@Test
public void testQueryParse() throws Exception {
HttpSolrServer server = (HttpSolrServer) createNewSolrServer();
SolrQuery query = new SolrQuery("id:1234");
QueryRequest req = new QueryRequest(query);
server.setParser(new NoOpResponseParser());
NamedList<Object> resp = server.request(req);
String responseString = (String) resp.get("response");
assertResponse(responseString);
server.shutdown();
}