lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yago Riveiro <yago.rive...@gmail.com>
Subject Re: Facet by truncated date
Date Thu, 31 Mar 2016 09:30:58 GMT
Emir,

  

I assume that this query will create N ranges (one for each day) and give you
the counts, in this case it works indeed. I'm confess that never use facet
ranges before.

  

What output will give the range query? The result of the ranges or the dates
truncated with the counts?

  
\--

  

/Yago Riveiro

  

![](https://link.nylas.com/open/m7fkqw0yim04itb62itnp7r9/eae9e3a3308049849ef01
3655c85f3ba)

On Mar 31 2016, at 10:26 am, Emir Arnautovic
&lt;emir.arnautovic@sematext.com&gt; wrote:  

> Hi Yago,  
Not sure if I misunderstood the case, but assuming you have date field  
called my_date you can facet last 10 days by day using range queries:

>

> ?facet.range=my_date&amp;facet.range.start=NOW/DAY-
10DAYS&amp;facet.range.end=NOW/DAY+1DAY&amp;facet.range.gap=+1DAY

>

> Regards,  
Emir

>

> On 31.03.2016 11:14, Yago Riveiro wrote:  
&gt; If you want aggregate the dat by the truncated date, I think the only way
to  
&gt; do it is using other field with the truncated date.  
&gt;  
&gt;  
&gt;  
&gt; You can use a update request processor to calculate the truncated data  
&gt; (https://wiki.apache.org/solr/UpdateRequestProcessor) or add the field in  
&gt; indexing time.  
&gt;  
&gt;  
&gt;  
&gt; date:"2016-03-31T12:00:0Z"  
&gt;  
&gt; truncated_date_s:'2016-03-31' or truncated_date_i:20160331 (this should
be  
&gt; more memory efficient)  
&gt;  
&gt; \\--  
&gt;  
&gt;  
&gt;  
&gt; /Yago Riveiro  
&gt;  
&gt;  
&gt;  
&gt;
![](https://link.nylas.com/open/m7fkqw0yim04itb62itnp7r9/4708d221e9a24b519bab6  
&gt; 3936013ce59)  
&gt;  
&gt; On Mar 31 2016, at 10:08 am, Emir Arnautovic  
&gt; &amp;lt;emir.arnautovic@sematext.com&amp;gt; wrote:  
&gt;  
&gt;&gt; Hi Robert,  
&gt; You can use range faceting and set use facet.range.gap to set how dates  
&gt; are "truncated".  
&gt;  
&gt;&gt; Regards,  
&gt; Emir  
&gt;  
&gt;&gt; On 31.03.2016 10:52, Robert Brown wrote:  
&gt; &amp;gt; Hi,  
&gt; &amp;gt;  
&gt; &amp;gt; Is it possible to facet by a date (solr.TrieDateField) but
truncated  
&gt; &amp;gt; to the day, or even the hour?  
&gt; &amp;gt;  
&gt; &amp;gt; If not, are there any other options apart from storing that
truncated  
&gt; &amp;gt; data in another (string?) field?  
&gt; &amp;gt;  
&gt; &amp;gt; Thanks,  
&gt; &amp;gt; Rob  
&gt; &amp;gt;  
&gt; &amp;gt;  
&gt;  
&gt;&gt; \\--  
&gt; Monitoring * Alerting * Anomaly Detection * Centralized Log Management  
&gt; Solr &amp;amp; Elasticsearch Support * &lt;http://sematext.com/&gt; 

&gt;  
&gt;

>

> \--  
Monitoring * Alerting * Anomaly Detection * Centralized Log Management  
Solr &amp; Elasticsearch Support * <http://sematext.com/>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message