lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Freeby <jamesfre...@yahoo.com.INVALID>
Subject Re: Median Date
Date Wed, 02 May 2018 21:25:21 GMT
 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 <jamesfreeby@yahoo.com.INVALID> 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  
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message