On Mon, Nov 21, 2016 at 3:42 PM, Michael Joyner <mich...@newsrx.com> wrote: > Help, > > (Solr 6.3) > > Trying to do a "sub-facet" using the new json faceting API, but can't seem > to figure out how to get the "max" date in the subfacet? > > I've tried a couple of different ways: > > == query == > > json.facet={ > code_s:{ > limit:-1, > type:terms,field:code_s,facet:{ > issuedate_tdt:"max(issuedate_tdt)" > } > } > } > > == partial response == > > facets":{ > "count":1310359, > "code_s":{ > "buckets":[{ > "val":"5W", > "count":255437, > "issuedate_tdt":1.4794452E12}, > { > "val":"LS", > "count":201407, > "issuedate_tdt":1.479186E12}, > > -- the date values seem to come back out as longs converted to float/double > which are then truncated and put into scientific notation? --
Hmmm, yeah... min/max are currently only implemented in terms of function queries (so you can do stuff like max(add(field1,field2))) The downside is that by default function queries use float/double, so we need to add support for other types. As a temporary workaround, the ms() function subtracts two dates and gives the result in milliseconds, and may work better for losing less information. min(ms(NOW, issuedate_tdt)) -Yonik