[
https://issues.apache.org/jira/browse/SOLR-6352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14610926#comment-14610926
]
Shalin Shekhar Mangar commented on SOLR-6352:
---------------------------------------------
An example of the current response format for range facets is as follows:
{code}
curl 'http://localhost:8983/solr/test/select' --data-binary 'q=price:[0 TO
100]&facet=true&facet.range=price&facet.range.start=0&facet.range.end=1000&facet.range.gap=100&wt=json&indent=on&stats=on&stats.field=price&facet.range.other=all'
{code}
{code}
"facet_counts":{
"facet_queries":{},
"facet_fields":{},
"facet_dates":{},
"facet_ranges":{
"price":{
"counts":[
"0.0",7,
"100.0",2,
"200.0",1,
"300.0",3,
"400.0",1,
"500.0",0,
"600.0",1,
"700.0",0,
"800.0",0,
"900.0",0],
"gap":100.0,
"start":0.0,
"end":1000.0,
"before":0,
"after":1,
"between":15}},
"facet_intervals":{},
"facet_heatmaps":{}},
"stats":{
"stats_fields":{
"price":{
"min":0.0,
"max":2199.0,
"count":16,
"missing":16,
"sum":5251.270030975342,
"sumOfSquares":6038619.175900028,
"mean":328.20437693595886,
"stddev":536.3536996709846}}}}
{code}
In order to hang stats off of range facets, I propose the following response
format:
{code}
curl 'http://localhost:8983/solr/test/select' --data-binary 'q=price:[0 TO
100]&facet=true&facet.range={!stats=s1}price&facet.range.start=0&facet.range.end=1000&facet.range.gap=100&wt=json&indent=on&stats=on&stats.field={!tag=s1}price&facet.range.other=all'
{code}
{code}
"facet_counts":{
"facet_queries":{},
"facet_fields":{},
"facet_dates":{},
"facet_ranges":{
"price":{
"counts":[
{
"start" : "0.0",
"count" : "7"
"stats":{
"stats_fields":{
"price":{
"min":0.0,
"max":92.0,
"count":7,
"missing":0,
"sum":198.43999862670898,
"sumOfSquares":14617.752310049444,
"mean":28.348571232387,
"stddev":38.7131800847063
}
}
}
},
{
"start" : "100.0"
"count" : "2"
"stats":{
"stats_fields":{
"price":{
"min":179.99000549316406,
"max":185.0,
"count":2,
"missing":0,
"sum":364.99000549316406,
"sumOfSquares":66621.40207742923,
"mean":182.49500274658203,
"stddev":3.5426010894910442
}
}
}
},
...
],
"gap":100.0,
"start":0.0,
"end":1000.0,
"before": {
"count" : "0",
"stats":{
"stats_fields":{
"price":{
"min":0,
"max":0,
"count":0,
"missing":0,
"sum":0,
"sumOfSquares":0,
"mean":0,
"stddev":0
}
}
}
},
"after":{
"count" : "1",
"stats":{
"stats_fields":{
"price":{
"min":2199.0,
"max":2199.0,
"count":1,
"missing":0,
"sum":2199.0,
"sumOfSquares":4835601.0,
"mean":2199.0,
"stddev":0.0
}
}
}
},
"between":{
"count" : "15",
"stats":{
"stats_fields":{
"price":{
"min":0.0,
"max":649.989990234375,
"count":15,
"missing":0,
"sum":3052.270030975342,
"sumOfSquares":1203018.175900028,
"mean":203.48466873168945,
"stddev":203.8781183115027
}
}
}
}}},
"facet_intervals":{},
"facet_heatmaps":{}},
"stats":{
"stats_fields":{
"price":{
"min":0.0,
"max":2199.0,
"count":16,
"missing":16,
"sum":5251.270030975342,
"sumOfSquares":6038619.175900028,
"mean":328.20437693595886,
"stddev":536.3536996709846}}}}
{code}
Thoughts?
> Let Stats Hang off of Range Facets
> ----------------------------------
>
> Key: SOLR-6352
> URL: https://issues.apache.org/jira/browse/SOLR-6352
> Project: Solr
> Issue Type: Sub-task
> Reporter: Hoss Man
> Assignee: Shalin Shekhar Mangar
>
> The same basic idea as the sibling pivot issue: ask the RangeFacet code to
> compute some stats X for each range it generates. We can do this with the
> existing {{stats.field}} params, but we'll leverage the {{tag}} local param
> of the {{stats.field}} instances to be able to associate which stats we want
> hanging off of which {{facet.range}} instance
> Example...
> {noformat}
> facet.range={!stats=s1}timestamp
> facet.range={!stats=s2}bytes_sent
> stats.field={!key=sum_bytes tag=s1 sum=true}bytes_sent
> stats.field={!tag=s1 percentiles=99}request_duration
> stats.field={!tag=s2 mean=true percentiles=99}request_duration
> {noformat}
> ...with the request above, (hypothetically over an index of web log traffic)
> each range bucket over the "timestamp" field will (in addition to simple
> facet count) also include the sum of total bytes_sent, and the 99th
> percentile of request_duration for all docs in that time range; and each
> range bucket over the "bytes_sent" field will (in addition to simple facet
> count) also include the mean and 99th percentile of request_duration.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]