I have a problem when I want to query from my java web service into solr server. My code looks like this:
CloudSolrServer solr = new CloudSolrServer("BigDataNew1:2181,BigDataNew2:2181,BigDataNew3:2181,BigDataNew4:2181,BigDataNew5:2181/solr");
Solr Queryquery = new SolrQuery();
ModifiableSolrParams param = new ModifiableSolrParams();
param.set("q",keyword).set("fl"," id, title, desc, pubDate, media, person, location").set("count","1").set("wt", "json").set("facet", true).set("start", "0").set("rows", "5");
QueryResponse response = solr.query(param);
SolrDocumentList list = response.getResults();
I got the following error:org.apache.solr.client.solrj.SolrServerException: No collection param specified on request and no default collection has been set.
Anybody know what the problem is?
Thanks
You'll need to tell CloudSolrServer which collection you want to query.
You can do this by setting it with setDefaultCollection:
solr.setDefaultCollection("foobar");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With