lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erick Erickson <erickerick...@gmail.com>
Subject Re: date difference faceting
Date Fri, 08 Jan 2016 17:09:50 GMT
I'm going to side-step your primary question and say that it's nearly
always best to do your calculations up-front during indexing to make
queries more efficient and thus serve more requests on the same
hardware. This assumes that the stat you're interested in is
predictable of course...

Best,
Erick

On Fri, Jan 8, 2016 at 2:23 AM, David Santamauro
<david.santamauro@gmail.com> wrote:
>
> Hi,
>
> I have two date fields, d_a and d_b, both of type solr.TrieDateField, that
> represent different events associated with a particular document. The
> interval between these dates is relevant for corner-case statistics. The
> interval is calculated as the difference: sub(d_b,d_a) and I've been able to
>
>   stats=true&stats.field={!func}sub(d_b,d_a)
>
> What I ultimately would like to report is the interval represented as a
> range, which could be seen as facet.query
>
> (pseudo code)
>   facet.query=sub(d_b,d_a)[ * TO 86400000 ] // day
>   facet.query=sub(d_b,d_a)[ 86400001 TO 604800000 ] // week
>   facet.query=sub(d_b,d_a)[ 604800001 TO 2592000000 ] // month
> etc.
>
> Aside from actually indexing the difference in a separate field, is there
> something obvious I'm missing? I'm on SOLR 5.2 in cloud mode.
>
> thanks
> David

Mime
View raw message