Example usage for org.apache.solr.client.solrj.impl NoOpResponseParser NoOpResponseParser

List of usage examples for org.apache.solr.client.solrj.impl NoOpResponseParser NoOpResponseParser

Introduction

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

Prototype

public NoOpResponseParser() 

Source Link

Usage

From source file:com.sitewhere.connectors.solr.search.SolrSearchProvider.java

License:Open Source License

@Override
public JsonNode executeQueryWithRawResponse(String queryString) throws SiteWhereException {
    try {/*from   w w w  .j a va  2 s  .  c  om*/
        LOGGER.debug("About to execute Solr search with query string: " + queryString);

        NoOpResponseParser rawJsonResponseParser = new NoOpResponseParser();
        rawJsonResponseParser.setWriterType("json");

        SolrQuery query = new SolrQuery();
        query.add(createParamsFromQueryString(queryString));
        QueryRequest request = new QueryRequest(query);
        request.setResponseParser(rawJsonResponseParser);
        NamedList<?> results = getSolr().getSolrClient().request(request);
        return MAPPER.readTree((String) results.get("response"));
    } catch (SolrServerException e) {
        throw new SiteWhereException("Unable to execute query.", e);
    } catch (IOException e) {
        throw new SiteWhereException("Unable to execute query.", e);
    }
}