How to do Multi Faceted search using hibernate in

2019-04-16 22:19发布

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条回答
2楼-- · 2019-04-16 22:35
登录 后发表回答