lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Scavilla <rscavi...@gmail.com>
Subject Facet Range by Distance generating count of field - need sum of the field
Date Fri, 03 Jan 2020 13:27:38 GMT
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!

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message