I suggest facet.query is the way to go for a handful of buckets/ranges.
I'm mobile so apologies for not providing some examples but something like a few of these
kinds of things:
facet.query={!lucene key=under_24_hours}update_date:[NOW-24HOURS TO NOW]
Things get interesting if you want < 3 days to not include under 24 hour ones too, but
just some considered Lucene query clauses will do the trick.
Erik
> On Jan 24, 2016, at 18:38, Jay Potharaju <jspotharaju@gmail.com> wrote:
>
> Thanks Pavel,
> I was trying it using the range faceting instead of facet.interval. Can
> someone comment on performance of using facet.interval with sharded index
> and high number of documents.
> Thanks
> J
>
> On Sun, Jan 24, 2016 at 1:09 PM, Pavel Polívka <polivka.pavel@gmail.com>
> wrote:
>
>> Hi,
>> We are doing this via interval facet:
>>
>> Something like this:
>> facet=on&
>> facet.interval=update_date&
>> facet.interval.set=[NOW-1DAY,NOW]&
>> facet.interval.set=[NOW-3DAY,NOW-1DAY)&
>> facet.interval.set=[NOW-7DAY,NOW-3DAY)&
>> facet.interval.set=[NOW-1MONTH,NOW-7DAY)&
>> facet.interval.set=[NOW-1YEAR,NOW-1MONTH)
>>
>> I do not know if this is a correct way of doing this, but I did not find
>> anything better.
>> Here is link for interval faceting in wiki:
>>
>> https://cwiki.apache.org/confluence/display/solr/Faceting#Faceting-IntervalFaceting
>>
>> Hope this helps.
>>
>> Pavel
>>
>>
>> ne 24. 1. 2016 v 17:20 odesílatel Jay Potharaju <jspotharaju@gmail.com>
>> napsal:
>>
>>> Hi,
>>> I am trying to calculate facet for update_date of the document. And would
>>> like to get the following values
>>> - < 24 Hrs
>>> - < 3 days
>>> - < 1 week
>>> - < 1 month
>>> - < 6 months
>>> - <1 year
>>>
>>> <field name="update_date" type="tdate" indexed="true" stored="true"
>>> required="true" multiValued="false" docValues="true"/>
>>>
>>> The above facet values should change every time someone queries,
>> therefore
>>> a document that was updated today will show will be in the facet "24
>> hrs"
>>> and when the same query runs 2 weeks from today, the document will be
>>> marked as "< 1 month".
>>>
>>> How can I set my facets to get the above values?
>>>
>>> --
>>> Thanks
>>> Jay
>
>
>
> --
> Thanks
> Jay Potharaju
|