Hi Robert,

How does this work?

{!frange l=0 u=5} sum(geodist())



On Fri, 3 Jan 2020 at 21:10, Robert Scavilla <rscavi...@gmail.com> wrote:

> Thank yo in advance for your help.
>
> I need to get the sum of a pivot range field. The following query uses the
> stats function to sum the *sumField* values. I'm trying to sum the same
> field in a frange subquery and I don't know how.
>
>
> /select?defType=edismax&q=*:*&fq={!geofilt}&fl=totalResultsUsers,_dist_:geodist(),score&sort=geodist()
>
> desc&facet=true&rows=0&facet.limit=-1&facet.mincount=1&facet.sort=value&stats=true&distanceUnits=miles&wt=json&fq=dId:193&sfield=Coordinates&pt=40.243919,-74.753489&d=5&stats.field={!tag=t1}sumField&facet.pivot={!stats=t1}startDate&fq=startDate:[2019-12-01
> TO *]&facet.query={!frange l=0 u=5}geodist()&facet.query={!frange l=5.001
> u=10}geodist()
>
> This query produces the following results:
>
>   "facet_counts":{
>     "facet_queries":{
>       "{!frange l=0 u=5}geodist()":27,
>       "{!frange l=5.001 u=10}geodist()":0},
>     "facet_pivot":{
>       "startDate":[{
>           "field":"startDate",
>           "value":"2019-12-01",
>           "count":27,
>           "stats":{
>             "stats_fields":{
>               "users":{
>                 "min":1.0,
>                 "max":158.0,
>                 **"count":27,
>                 "missing":0,
>                 "sum":488.0,
>                 "sumOfSquares":40848.0,
>                 "mean":18.074074074074073,
>                 "stddev":35.09758475793535}}}}]}},
>
>
> ....
>
> What I'm going for is line: "*{!frange l=0 u=5}geodist()":27* should be
> 488.0 which is the sum of the field as opposed to 27 which is the count of
> the field.
>
> Thank you!
>


-- 
-- 
Regards,

*Paras Lehana* [65871]
Development Engineer, Auto-Suggest,
IndiaMART Intermesh Ltd.

8th Floor, Tower A, Advant-Navis Business Park, Sector 142,
Noida, UP, IN - 201303

Mob.: +91-9560911996
Work: 01203916600 | Extn:  *8173*

-- 
*
*

 <https://www.facebook.com/IndiaMART/videos/578196442936091/>

Reply via email to