Example usage for org.apache.solr.client.solrj SolrClient queryAndStreamResponse

List of usage examples for org.apache.solr.client.solrj SolrClient queryAndStreamResponse

Introduction

In this page you can find the example usage for org.apache.solr.client.solrj SolrClient queryAndStreamResponse.

Prototype

public QueryResponse queryAndStreamResponse(String collection, SolrParams params,
            FastStreamingDocsCallback callback) throws SolrServerException, IOException 

Source Link

Usage

From source file:org.janusgraph.diskstorage.solr.SolrResultIterator.java

License:Apache License

public SolrResultIterator(SolrClient solrClient, Integer limit, int offset, int nbDocByQuery, String collection,
        SolrQuery solrQuery, Function<SolrDocument, E> function) throws SolrServerException, IOException {
    this.solrClient = solrClient;
    count = 0;/*from   ww  w  .j a  v  a2s.  c om*/
    this.offset = offset;
    this.batchSize = nbDocByQuery;
    queue = new LinkedBlockingQueue<>();
    this.collection = collection;
    this.solrQuery = solrQuery;
    this.getFieldValue = function;
    final long nbFound = solrClient
            .queryAndStreamResponse(collection, solrQuery, new SolrCallbackHandler(this, function)).getResults()
            .getNumFound() - offset;
    this.limit = limit != null ? Math.min(nbFound, limit) : nbFound;
    numBatches = 1;
}