You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Tom Evans <te...@googlemail.com> on 2016/07/25 13:57:55 UTC

min()/max() on date fields using JSON facets

Hi all

I'm trying to replace a use of the stats module with JSON facets in
order to calculate the min/max date range of documents in a query. For
the same search, "stats.field=date_published" returns this:

{u'date_published': {u'count': 86760,
                     u'max': u'2016-07-13T00:00:00Z',
                     u'mean': u'2013-12-11T07:09:17.676Z',
                     u'min': u'2011-01-04T00:00:00Z',
                     u'missing': 0,
                     u'stddev': 50006856043.410477,
                     u'sum': u'3814570-11-06T00:00:00Z',
                     u'sumOfSquares': 1.670619719649826e+29}}

For the equivalent JSON facet - "{'date.max': 'max(date_published)',
'date.min': 'min(date_published)'}" - I'm returned this:

{u'count': 86760, u'date.max': 1468368000000.0, u'date.min': 1294099200000.0}

What do these numbers represent - I'm guessing it is milliseconds
since epoch? In UTC?
Is there any way to control the output format or TZ?
Is there any benefit in using JSON facets to determine this, or should
I just continue using stats?

Cheers

Tom

Re: min()/max() on date fields using JSON facets

Posted by Yonik Seeley <ys...@gmail.com>.
On Mon, Jul 25, 2016 at 9:57 AM, Tom Evans <te...@googlemail.com> wrote:
> For the equivalent JSON facet - "{'date.max': 'max(date_published)',
> 'date.min': 'min(date_published)'}" - I'm returned this:
>
> {u'count': 86760, u'date.max': 1468368000000.0, u'date.min': 1294099200000.0}
>
> What do these numbers represent - I'm guessing it is milliseconds
> since epoch? In UTC?

Yeah, that would probably be it.
IIRC min/max only currently support numerics.  Could you open a JIRA
issue for this?

-Yonik