I tried getFieldStatsInfo(). I got a stats of the stats with this method (ie. sum (sum(count)) of all the group'ed results. But it is not what I want. I want a list of stats (ie. sum(count), group by block num). With a debugger, I could see the information I want in this private object response._statsInfo.
I could grab the information I want with response.toString(). That's what I did and parse the string myself for now. :( On Sun, Jul 27, 2014 at 1:41 PM, Erick Erickson <erickerick...@gmail.com> wrote: > Have you tried the getFieldStatsInfo method in the QueryResponse object? > > Best, > Erick > > > On Sat, Jul 26, 2014 at 3:36 PM, Edith Au <edith...@gmail.com> wrote: > > > I have a solr query like this > > > > q=categories:cat1 OR > > categories:cat2&stats=true&stats.field=count&stats.facet=block_num > > > > Basically, I want to get the sum(count) group by block num. > > > > > > This query works on a browser. But with solrj, I could not access the > stats > > fields from the Response obj. I can do a response.getFieldStatsInfo(). > But > > it is not what I want. Here is how I construct the query > > > > SolrQuery query = new SolrQuery(q); > > query.add("stats", "true"); > > query.add("stats.field", "count"); > > query.add("stats.facet", "block_num"); > > > > With a debugger, I could see that the response has a private statsInfo > > object and it has the information I am looking for. But there is no api > to > > access the private object. > > > > I would like to know if there is > > > > 1. a better way to construct my query. I only need the sum of (count), > > group by block num > > 2. a way to access the hidden statsInfo object in the query > response()? > > [it is so frustrated. I can see all the info I need in the private obj > > on > > my debugger!] > > > > Thanks! > > > > > > ps. I posted this question on stackoverflow but have gotten no response > so > > far. Any help will be greatly appreciated! > > > > Thanks! > > >