use of com.nixmash.blog.mvc.containers.ProductCategory in project nixmash-blog by mintster.
the class SolrController method productCategories.
@RequestMapping(value = "/products/categories", method = RequestMethod.GET)
public String productCategories(Model model) {
FacetPage<Product> catfacetPage = productService.getFacetedProductsCategory();
Page<FacetFieldEntry> catPage = catfacetPage.getFacetResultPage(Product.CATEGORY_FIELD);
List<ProductCategory> results = new ArrayList<ProductCategory>();
for (FacetFieldEntry entry : catPage) {
results.add(new ProductCategory(entry.getValue(), toIntExact(entry.getValueCount())));
}
model.addAttribute(MODEL_ATTRIBUTE_PRODUCT_CATEGORIES, results);
return PRODUCT_CATEGORIES_VIEW;
}
Aggregations