Reputation: 5802
Whenever I execute a query on Solr, even the most simple query *:*
, I get the error message
Exception in thread "main" org.apache.solr.client.solrj.SolrServerException: Error executing query
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:100)
at org.apache.solr.client.solrj.SolrServer.query(SolrServer.java:301)
at com.atmire.dspace.versioning.ModificationLogger.search(ModificationLogger.java:294)
at com.atmire.dspace.versioning.ModificationsReporter.main(ModificationsReporter.java:92)
Caused by: org.apache.http.ParseException: Invalid content type:
at org.apache.http.entity.ContentType.parse(ContentType.java:233)
at org.apache.solr.client.solrj.impl.HttpSolrServer.executeMethod(HttpSolrServer.java:496)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:210)
at org.apache.solr.client.solrj.impl.HttpSolrServer.request(HttpSolrServer.java:206)
at org.apache.solr.client.solrj.request.QueryRequest.process(QueryRequest.java:91)
... 3 more
Though the same query runs fine against when using the webclient or using curl:
curl http://localhost:8080/solr/versioning/select\?q\=\*%3A\*\&wt\=json\&indent\=true
I'm quite confused as to why the query would not work from java. The relevant java code
SolrQuery query = new SolrQuery().setQuery("*:*");
query.setRows(rpp).setStart(start);
QueryResponse queryResponse = solr.query(query);
return queryResponse.getResults();
It seems that SolrQuery nor solr have the option to explicitely set the Content-Type, at least not that I could find in the API docs. Furthermore, I'm quite surprised that if I would have to speicfy the Content-Type, that it actually works with curl even when I don't add wt=json
. Though I suspect that that is for the response, not the request.
Upvotes: 0
Views: 2384
Reputation: 9789
It looks like maybe it is not actually pointing at the Solr server. Can you double check your earlier code and see if you are definitely setting the right host and port (which is not default for you), as well as the right collection.
Upvotes: 2