1
votes

I am trying to get the count of two fields grouped together in solr. exactly as we do in mysql

select count(*), F1, F2 from MyTable where F3='X' group by F1,F2

when we try facet query and facet field like below

http://localhost:8888/solr/myCore/select?q=*:*&facet=true&facet.field=F1&facet.field=F2&wt=xml&fq=F3:X&version=2.2&rows=1

but this gives the count for each field separately. Anybody knows how to get the desired grouping? what should the link above be to get the correct grouping? Thanks

2

2 Answers

0
votes

When indexing make a new field that has both F1 and F2 in the same field (like F1-F2) and facet on that.

0
votes

facet.field would give you different facet count each for each facet.field resp.
If you want to group for facets, you probably need to create a new field with the combined content. e.g. f1_f2 which would have f1 value append to f2

e.g.
F1 = Aero
F2 = Space
F1_F2=Aero_Space (This field needs to be created at index time at client side.)