Example usage for org.apache.solr.client.solrj.io.stream SolrStream SolrStream

List of usage examples for org.apache.solr.client.solrj.io.stream SolrStream SolrStream

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj.io.stream SolrStream SolrStream.

Prototype


public SolrStream(String baseUrl, SolrParams params) 

Source Link

Usage

From source file:org.apache.drill.exec.store.solr.SolrClientAPIExec.java

License:Apache License

public SolrStream getSolrStreamResponse(String solrServer, String solrCoreName, List<String> fields,
        StringBuilder filters, String uniqueKey, long solrDocFetchCount) {

    Map<String, String> solrParams = new HashMap<String, String>();
    solrParams.put("q", uniqueKey + ":*");

    solrParams.put("sort", uniqueKey + " desc ");
    solrParams.put("fl", Joiner.on(",").join(fields));
    solrParams.put("qt", "/export");
    if (solrDocFetchCount >= 0) {
        solrParams.put("rows", String.valueOf(solrDocFetchCount));
    }/* w  w w .ja v a2  s.co m*/
    if (filters.length() > 0) {
        solrParams.put("fq", filters.toString());
        SolrClientAPIExec.logger.info("Filter query [ " + filters.toString() + " ]");
    }

    if (solrCoreName != null) {
        solrServer = solrServer + solrCoreName;
    }
    SolrClientAPIExec.logger.info("Sending request to solr server " + solrServer);
    SolrClientAPIExec.logger.info("Response field list " + fields);
    SolrStream solrStream = new SolrStream(solrServer, solrParams);
    return solrStream;

}