Thanks Edward. Can we find stats on two fields ? (eg - sum = sum of (userful+not useful)) ?
On Tue, 20 Nov 2018 at 16:14, Edward Ribeiro <edward.ribe...@gmail.com> wrote: > You are using a function query as stats.field and as seen here: > https://lucene.apache.org/solr/guide/7_4/function-queries.html the syntax > for termfreq is termfreq(field_name, value). You're using > termfreq('num_not_useful','num_useful'). It looks like num_useful is a > numeric (int, float) type in your schema and you are passing a string > ('num_useful'). If that is the case then you need to pass a numeric value > (e.g., termfreq(num_not_useful, 99)). Does it make sense? > > Edward > > On Tue, Nov 20, 2018 at 6:59 AM Anil <anilk...@gmail.com> wrote: > > > HI , > > > > I am using stats component to determine stats on two columns together. > > stats query is failing with following exception - > > *Invalid Number: num_useful * > > > > > > *Query response : * > > { > > "responseHeader": { > > "zkConnected": true, > > "status": 400, > > "QTime": 19, > > "params": { > > * "q": "cid:HT",* > > "indent": [ > > "true", > > "true" > > ], > > "stats": "true", > > "rows": [ > > "0", > > "0" > > ], > > "wt": "json", > > "stats.field": "*{!func}termfreq('num_not_useful','num_useful')*" > > } > > }, > > "error": { > > "metadata": [ > > "error-class", > > "org.apache.solr.common.SolrException", > > "root-error-class", > > "org.apache.solr.common.SolrException" > > ], > > "msg": "Invalid Number: num_useful", > > "code": 400 > > } > > } > > > > Could you please help me in resolving the issue? Thanks. > > > > Regards, > > Anil > > >