Reputation: 4319
I have columns named categoryid, description, packid, imageurl... and many other columns. A category with description, imageurl can contain multiple packsid. Now I need to find out in solr, how many categories are there and how many packs in each cateogry. For this I do a facet.pivot on
CCategoryId,PPackId
I get the category id and the packid inside them. But how to get the description and imageurl for the categoryid. Is there a way wherein I can get these values along with categoryid in the pivot itself
This is my Solr api
http://172.28.0.162:8983/solr/cpaCore/select?q=PIsActive:true&wt=json&indent=true&debugQuery=true&fl=CategoryId,Description,ImageUrl, PackId, groupfield&facet=true&facet.pivot=CategoryId,PackId
I need to get description and ImageUrl for every Categoryid
Update This is my table in solr Categoryid, Description, ImageUrl, Packid, Packinfo, Packgrop......
This is what I need Group by (Categoryid, Description and ImageUrl) combined and then group by packid on the result from the above group by
So the result something like
--field Category
--value :.. ,
--field: description
--value : ,
--field: imageurl
--value ...
--count : ...
-----field: packid
-----value: 1
-----count
-----field: packid
-----value: 2
For more clarity adding resulting result in the form of table that I need
catid desc imageurl packid
1 x y 11
1 x y 12
1 x y 13
also it should give me count of unique(catid, desc, imageurl) and count of packid in this unique(catid, desc, imageurl)
Upvotes: 0
Views: 1281
Reputation: 7138
When you do faceting(grouping), the results would be based on group functions like count. And once grouping is done on a specific field, the others field values could be different. For Ex
catId, packId, desc, Img
1,1,desc1,img1
1,2,desc1,img1
1,3,desc1,img1
2,1,desc2,img2
2,2,desc2,img2
http://localhost:8983/solr/ram_core/select?q=*&facet=true&facet.field=catId&facet.pivot=catId,img,desc&facet.pivot=catId,packId&wt=json&indent=true
Here I gave two pivots, one for catId, img, desc, and one for catid, packId
Results: catId1,img1,desc1 - 3 catId2,img2,desc2 - 2
catId1,packId1 - 1 catId2,packId2 - 1 catId3,packId3 - 1 catId4,packId4 - 1 catId5,packId5 - 1
Upvotes: 1