/** * Query solr, and stream the results. Unlike the standard query, this will * send events for each Document rather then add them to the QueryResponse. * * Although this function returns a 'QueryResponse' it should be used with care * since it excludes anything that was passed to callback. Also note that * future version may pass even more info to the callback and may not return * the results in the QueryResponse. * * @param collection the Solr collection to query * @param params an object holding all key/value parameters to send along the request * @param callback the callback to stream results to * * @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server * * @since solr 5.1 */ public QueryResponse queryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback) throws SolrServerException, IOException { ResponseParser parser = new StreamingBinaryResponseParser(callback); QueryRequest req = new QueryRequest(params); req.setStreamingResponseCallback(callback); req.setResponseParser(parser); return req.process(this, collection); }
/** * Query solr, and stream the results. Unlike the standard query, this will * send events for each Document rather then add them to the QueryResponse. * * Although this function returns a 'QueryResponse' it should be used with care * since it excludes anything that was passed to callback. Also note that * future version may pass even more info to the callback and may not return * the results in the QueryResponse. * * @param collection the Solr collection to query * @param params an object holding all key/value parameters to send along the request * @param callback the callback to stream results to * * @return a {@link org.apache.solr.client.solrj.response.QueryResponse} containing the response * from the server * * @throws IOException If there is a low-level I/O error. * @throws SolrServerException if there is an error on the server * * @since solr 5.1 */ public QueryResponse queryAndStreamResponse(String collection, SolrParams params, StreamingResponseCallback callback) throws SolrServerException, IOException { ResponseParser parser = new StreamingBinaryResponseParser(callback); QueryRequest req = new QueryRequest(params); req.setStreamingResponseCallback(callback); req.setResponseParser(parser); return req.process(this, collection); }