There are two ways to do this with SolrJ: 1) Use the JDBC driver.
2) Use the SolrStream to send the request and then read() the Tuples. This is what the JDBC driver does under the covers. The sample code can be found here: https://github.com/apache/lucene-solr/blob/master/solr/solrj/src/java/org/apache/solr/client/solrj/io/sql/StatementImpl.java The constructStream() method creates a SolrStream with the request. Joel Bernstein http://joelsolr.blogspot.com/ On Thu, Aug 11, 2016 at 10:05 AM, Pablo Anzorena <anzorena.f...@gmail.com> wrote: > Hey, > > I'm trying to get the response of solr via QueryResponse using > QueryResponse queryResponse = client.query(solrParams); (where client is a > CloudSolrClient) > > The error it thows is: > > org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException: > Error > from server at http://tywin:8983/solr/testcollection1_shard1_replica1: > Expected mime type application/octet-stream but got text/plain. > {"result-set":{"docs":[ > {"count(*)":5304,"d1":2}, > {"count(*)":5160,"d1":1}, > {"count(*)":5016,"d1":3}, > {"count(*)":4893,"d1":4}, > {"count(*)":4824,"d1":5}, > {"EOF":true,"RESPONSE_TIME":11}]}} > at > org.apache.solr.client.solrj.impl.HttpSolrClient. > executeMethod(HttpSolrClient.java:558) > > Then I tryed to implement a custom ResponseParser that override the > getContentType() and returns "text/plain", but it returns another error. > > So... Is it a way to get the sql response via this method? > > I make it works via Connection and ResultSets, but I need to use the other > way (if possible). > > Thanks! >