How to do Multi Faceted search using hibernate in java?

一曲冷凌霜 提交于 2019-12-06 15:01:37

问题


I am using Hibernate 4 along with lucene 3.6. I have a requirement related to facet count. In my requirement I have an entity "Product". Entity "Product" has some property for example id, color, brand.

Now my requirement is that I want to get facet count for this entity in multidimension, get count for red(color) nike(brand) apparel.

So take a example. I have following product entities saved in my database.

id brand color
1 reebok red
2 reebok black
3 reebok green
4 Lee red
5 Lee black
6 Lee black

Now I want my code to take atleast two parameters(i.e. firstGroupBy, secondGroupBy) which are "brand" and "color" in this case and return results as below

reebok(3)
reebok red(1)
reebok black(1)
reebok green(2)
Lee(3)
Lee red(1)
Lee black(2)

Is it possible to do it in hibernate 4? If yes then how can I do this?


回答1:


Following url explains how to do

http://www.hascode.com/2012/03/hibernate-search-faceting-discrete-and-range-faceting-by-example/

Hope it helps



来源:https://stackoverflow.com/questions/17468263/how-to-do-multi-faceted-search-using-hibernate-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!