com.unbxd.client.search.response.SearchResponse Maven / Gradle / Ivy
package com.unbxd.client.search.response;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created with IntelliJ IDEA.
* User: sourabh
* Date: 08/07/14
* Time: 10:59 AM
* To change this template use File | Settings | File Templates.
*/
public class SearchResponse {
private int _statusCode;
private int _errorCode;
private String _message;
private int _queryTime;
private int _totalResultsCount;
private SearchResults _results;
private BucketResults _buckets;
private Facets _facets;
private Stats _stats;
private List _spellCorrections;
private Banners _banner;
private RedirectData redirect;
public SearchResponse(Map params){
if(params.containsKey("error")){
Map error = (Map) params.get("error");
this._errorCode = (Integer) error.get("code");
this._message = (String) error.get("msg");
}else{
this._message = "OK";
Map metaData = (Map) params.get("searchMetaData");
this._statusCode = (Integer) metaData.get("status");
if(metaData.containsKey("queryTime")) {
this._queryTime = (Integer) metaData.get("queryTime");
}
if(params.containsKey("response")){
Map response = (Map) params.get("response");
this._totalResultsCount = (Integer) response.get("numberOfProducts");
this._results = new SearchResults((List