/* (non-Javadoc)
   * @see fr.hoteia.qalingo.core.solr.service.ProductSkuSolrService#searchProductSku(java.lang.String, java.lang.String, java.lang.String)
   */
  public ProductSkuResponseBean searchProductSku(
      String searchBy, String searchText, String facetField)
      throws SolrServerException, IOException {
    SolrQuery solrQuery = new SolrQuery();
    if (StringUtils.isEmpty(searchBy)) {
      throw new IllegalArgumentException("searcBy field can not be Empty or Blank ");
    }

    if (StringUtils.isEmpty(searchText)) {
      solrQuery.setQuery(searchBy + ":*");
    } else {
      solrQuery.setQuery(searchBy + ":" + searchText + "*");
    }

    if (StringUtils.isNotEmpty(facetField)) {
      solrQuery.setFacet(true);
      solrQuery.setFacetMinCount(1);
      solrQuery.setFacetLimit(8);
      solrQuery.addFacetField(facetField);
    }

    SolrRequest request = new QueryRequest(solrQuery, METHOD.POST);
    QueryResponse response =
        new QueryResponse(productSkuSolrServer.request(request), productSkuSolrServer);
    logger.debug("QueryResponse Obj: " + response);
    List<ProductSkuSolr> productSkuSolrList = response.getBeans(ProductSkuSolr.class);
    logger.debug(" productSkuSolrList: " + productSkuSolrList);
    ProductSkuResponseBean productResponseBean = new ProductSkuResponseBean();
    productResponseBean.setProductSkuSolrList(productSkuSolrList);
    logger.debug("productSkuSolrList add sucessflly in productResponseBeen ");
    if (StringUtils.isNotEmpty(facetField)) {
      List<FacetField> productSkuSolrFacetFieldList = response.getFacetFields();
      logger.debug("ProductFacetFileList: " + productSkuSolrFacetFieldList);
      productResponseBean.setProductSkuSolrFacetFieldList(productSkuSolrFacetFieldList);
      logger.debug(" ProductFacetFileList Add sucessflly in productResponseBeen  ");
    }
    return productResponseBean;
  }
 /* (non-Javadoc)
  * @see fr.hoteia.qalingo.core.solr.service.ProductSkuSolrService#searchProductSku()
  */
 public ProductSkuResponseBean searchProductSku() throws SolrServerException, IOException {
   SolrQuery solrQuery = new SolrQuery();
   solrQuery.setQuery("*");
   solrQuery.setFacet(true);
   solrQuery.setFacetMinCount(1);
   solrQuery.setFacetLimit(8);
   solrQuery.addFacetField("businessname");
   solrQuery.addFacetField("code");
   SolrRequest request = new QueryRequest(solrQuery, METHOD.POST);
   // request.setPath(getRequestPath());
   QueryResponse response =
       new QueryResponse(productSkuSolrServer.request(request), productSkuSolrServer);
   logger.debug("QueryResponse Obj: " + response);
   List<ProductSkuSolr> productSkuSolrList = response.getBeans(ProductSkuSolr.class);
   logger.debug(" productSkuSolrList: " + productSkuSolrList);
   List<FacetField> productSkuSolrFacetFieldList = response.getFacetFields();
   logger.debug("ProductFacetFileList: " + productSkuSolrFacetFieldList);
   ProductSkuResponseBean productSkuResponseBean = new ProductSkuResponseBean();
   productSkuResponseBean.setProductSkuSolrList(productSkuSolrList);
   productSkuResponseBean.setProductSkuSolrFacetFieldList(productSkuSolrFacetFieldList);
   logger.debug(
       "productSkuSolrList  And ProductFacetFileList Add sucessflly in productSkuResponseBeen  ");
   return productSkuResponseBean;
 }