I'm using Solr 4.10.
I have enabled the /export
request handler for an index by adding this to the solrconfig.xml
(as mentioned here: https://cwiki.apache.org/confluence/display/solr/Exporting+Result+Sets):
<requestHandler name="/export" class="solr.SearchHandler">
<lst name="invariants">
<str name="rq">{!xport}</str>
<str name="wt">xsort</str>
<str name="distrib">false</str>
</lst>
<arr name="components">
<str>query</str>
</arr>
</requestHandler>
Now I can use: http://localhost:8983/solr/index/select?.... as well as http://localhost:8983/solr/index/export?.... from a browser or curl.
But, I cannot get it to run properly using SolrJ.
I tried (as suggested here: https://lucene.apache.org/solr/4_10_0/solr-solrj/index.html):
SolrQuery query = new SolrQuery();
...
query.setRequestHandler("/export");
...
httpSolrServer.query(query);
The query now has a parameter &qt=export
. It blew up giving me:
org.apache.solr.client.solrj.SolrServerException: Error executing query
More search suggested using SolrRequest
instead of SolrQuery
, I tried it:
SolrQuery query = new SolrQuery();
...
query.setRequestHandler("/export");
SolrRequest solrRequest = new QueryRequest(query);
httpSolrServer.request(solrRequest);
Now I get:
java.nio.charset.UnsupportedCharsetException: gzip
Any ideas?
---edit---
I found an option in httpSolrServer.request()
to add a ResponseParser
. I found 4 ResponseParser
s. Tried them all, the only one that worked was NoOpResponseParser
. Now I have the correct results, but dumped as a plain string in a single entry in a NamedList
. I tried to parse it as JSON, but it's not in proper format. Each 30,000 document, there's a missing ,
!!!!.
I returned back to solrconfig.xml
and changed wt
in the /export
handler from xsort
to json
. Now the response format has changed, but it's also not in proper format (data is incomplete) !!!!. And XML
is not
supported.
I'm truly baffled.