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 Cool Techi <co...@outlook.com> on 2013/02/09 07:15:08 UTC

Hourly Faceting

Hi,

I want to facet results on an hourly basis, the following query gives me an hourly breakdown, but with the date part. I want just the hour part across the days. Is there any other way of doing this,

<lst name="params">
<str name="facet.date.start">2013-02-01T00:00:00Z-330MINUTES</str>
<str name="facet">true</str>
<str name="q">twitterId:191343557</str>
<str name="facet.date">createdOnGMTDate</str>
<str name="facet.date.gap">+1HOUR</str>
<str name="facet.date.end">2013-02-08T23:59:59Z-330MINUTES</str>
<str name="rows">0</str>
</lst>

Result----

<int name="2013-01-31T18:30:00Z">0</int>
<int name="2013-01-31T19:30:00Z">0</int>
<int name="2013-01-31T20:30:00Z">0</int>
<int name="2013-01-31T21:30:00Z">0</int>
<int name="2013-01-31T22:30:00Z">0</int>
<int name="2013-01-31T23:30:00Z">0</int>

Desired Result

<int name="18:30:00Z">0</int>
<int name="19:30:00Z">0</int>
<int name="20:30:00Z">0</int>
<int name="21:30:00Z">0</int>
<int name="22:30:00Z">0</int>
<int name="23:30:00Z">0</int>

Regards,
Ayush
 		 	   		  

Re: Hourly Faceting

Posted by Upayavira <uv...@odoko.co.uk>.
Do it on the client, strip off the date and add together ny values you
have for the same hour.

Upayavira

On Sat, Feb 9, 2013, at 06:15 AM, Cool Techi wrote:
> Hi,
> 
> I want to facet results on an hourly basis, the following query gives me
> an hourly breakdown, but with the date part. I want just the hour part
> across the days. Is there any other way of doing this,
> 
> <lst name="params">
> <str name="facet.date.start">2013-02-01T00:00:00Z-330MINUTES</str>
> <str name="facet">true</str>
> <str name="q">twitterId:191343557</str>
> <str name="facet.date">createdOnGMTDate</str>
> <str name="facet.date.gap">+1HOUR</str>
> <str name="facet.date.end">2013-02-08T23:59:59Z-330MINUTES</str>
> <str name="rows">0</str>
> </lst>
> 
> Result----
> 
> <int name="2013-01-31T18:30:00Z">0</int>
> <int name="2013-01-31T19:30:00Z">0</int>
> <int name="2013-01-31T20:30:00Z">0</int>
> <int name="2013-01-31T21:30:00Z">0</int>
> <int name="2013-01-31T22:30:00Z">0</int>
> <int name="2013-01-31T23:30:00Z">0</int>
> 
> Desired Result
> 
> <int name="18:30:00Z">0</int>
> <int name="19:30:00Z">0</int>
> <int name="20:30:00Z">0</int>
> <int name="21:30:00Z">0</int>
> <int name="22:30:00Z">0</int>
> <int name="23:30:00Z">0</int>
> 
> Regards,
> Ayush
>  		 	   		  

Re: Hourly Faceting

Posted by Erik Hatcher <er...@gmail.com>.
At index time, add an hour field and then just field.facet on that. 

If you want to search/facet on something that you have available at index time... index it that way :) rather than trying to do the work at query time. 

And you could certainly do this automatically with a copyField and a custom field type.  Or of course easily from your indexer probably too. 

     Erik

On Feb 9, 2013, at 1:15, Cool Techi <co...@outlook.com> wrote:

> Hi,
> 
> I want to facet results on an hourly basis, the following query gives me an hourly breakdown, but with the date part. I want just the hour part across the days. Is there any other way of doing this,
> 
> <lst name="params">
> <str name="facet.date.start">2013-02-01T00:00:00Z-330MINUTES</str>
> <str name="facet">true</str>
> <str name="q">twitterId:191343557</str>
> <str name="facet.date">createdOnGMTDate</str>
> <str name="facet.date.gap">+1HOUR</str>
> <str name="facet.date.end">2013-02-08T23:59:59Z-330MINUTES</str>
> <str name="rows">0</str>
> </lst>
> 
> Result----
> 
> <int name="2013-01-31T18:30:00Z">0</int>
> <int name="2013-01-31T19:30:00Z">0</int>
> <int name="2013-01-31T20:30:00Z">0</int>
> <int name="2013-01-31T21:30:00Z">0</int>
> <int name="2013-01-31T22:30:00Z">0</int>
> <int name="2013-01-31T23:30:00Z">0</int>
> 
> Desired Result
> 
> <int name="18:30:00Z">0</int>
> <int name="19:30:00Z">0</int>
> <int name="20:30:00Z">0</int>
> <int name="21:30:00Z">0</int>
> <int name="22:30:00Z">0</int>
> <int name="23:30:00Z">0</int>
> 
> Regards,
> Ayush
>