lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Santamauro <david.santama...@gmail.com>
Subject Re: date difference faceting
Date Fri, 08 Jan 2016 18:54:24 GMT

For anyone wanting to know an answer, I used

facet.query={!frange l=0 u=31104000000}ms(d_b,d_a)
facet.query={!frange l=31104000001 u=62208000000}ms(d_b,d_a)
facet.query={!frange l=62208000001 u=155520000000}ms(d_b,d_a)

etc ...

Not the prettiest nor most efficient but accomplishes what I need 
without re-indexing TBs of data.

thanks.

On 01/08/2016 12:09 PM, Erick Erickson wrote:
> 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