Median Date
All, We have a dateImported field in our schema. I'd like to generate a statistic showing the median dateImported (actually we want median age of the documents, based on the dateImported value). I have other stats that calculate the median value of numbers (like price). This was achieved with something like: rows=0&stats=true&stats.field={!tag=piv1 percentiles='50'}price&facet=true&facet.pivot={!stats=piv1 }status I have not found a way to calculate the median dateImported. The mean works, but we need median. Any help would be appreciated? Cheers, Jim
Re: Median Date
All, percentiles only work with numbers, not dates. If I use the ms function, I can get the number of milliseconds between NOW and the import date. Then we can use that result in calculating the median age of the documents using percentiles. rows=0&stats=true&stats.field={!tag=piv1 percentiles='50' func}ms(NOW, importDate)&facet=true&facet.pivot={!stats=piv1 }status I hope this helps someone else :) Also, let me know if there's a better way to do this. Cheers, Jim On Tuesday, May 1, 2018 03:27:10 PM PDT, Jim Freeby wrote: All, We have a dateImported field in our schema. I'd like to generate a statistic showing the median dateImported (actually we want median age of the documents, based on the dateImported value). I have other stats that calculate the median value of numbers (like price). This was achieved with something like: rows=0&stats=true&stats.field={!tag=piv1 percentiles='50'}price&facet=true&facet.pivot={!stats=piv1 }status I have not found a way to calculate the median dateImported. The mean works, but we need median. Any help would be appreciated? Cheers, Jim
Facet Range with Stats
All, I'd like to generate stats for the results of a facet range. For example, calculate the mean sold price over a range of months. Does anyone know how to do this? This Jira issue seems to indicate its not yet possible. [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | | [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | Thanks, Jim
Re: Facet Range with Stats
I found a solution. If I use tags for the facet range definition and the stats definition, I can include it in the facet pivot stats=true stats.field={!tag=piv1 percentiles='50'}price facet=true facet.range={!tag=r1}someDate f.someDate.facet.range.start=2018-01-01T00:00:00Z f.someDate.facet.range.end=2018-04-30T00:00:00Z f.someDate.facet.range.gap=+1MONTH facet.pivot={!stats=piv1 range=r1}category Please let me know if there's a better way to achieve this. Cheers, Jim On Friday, May 11, 2018 09:23:39 AM PDT, Jim Freeby wrote: All, I'd like to generate stats for the results of a facet range. For example, calculate the mean sold price over a range of months. Does anyone know how to do this? This Jira issue seems to indicate its not yet possible. [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | | [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | Thanks, Jim
Re: Facet Range with Stats
Correction. The solution below did not quite get what we need. I need the stats reports for the range. I'll keep digging on this one On Friday, May 11, 2018 10:59:45 AM PDT, Jim Freeby wrote: I found a solution. If I use tags for the facet range definition and the stats definition, I can include it in the facet pivot stats=true stats.field={!tag=piv1 percentiles='50'}price facet=true facet.range={!tag=r1}someDate f.someDate.facet.range.start=2018-01-01T00:00:00Z f.someDate.facet.range.end=2018-04-30T00:00:00Z f.someDate.facet.range.gap=+1MONTH facet.pivot={!stats=piv1 range=r1}category Please let me know if there's a better way to achieve this. Cheers, Jim On Friday, May 11, 2018 09:23:39 AM PDT, Jim Freeby wrote: All, I'd like to generate stats for the results of a facet range. For example, calculate the mean sold price over a range of months. Does anyone know how to do this? This Jira issue seems to indicate its not yet possible. [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | | [SOLR-6352] Let Stats Hang off of Range Facets - ASF JIRA | | | Thanks, Jim