Hi Kris

It's actually because of Sphinx, which has no concept of a date type, just 
timestamps. I'm afraid you'll need to cast these values yourself to dates using 
.to_date.

-- 
Pat

On 18/08/2011, at 2:46 AM, Kris wrote:

> I have a DATE column in my database, but when I get the facets for
> this column they are datetimes so I end up with many facets than I
> should have.
> 
> define_index do
>  has :posted_on, :facet => true
> end
> 
> logger.debug Entry.facets(search_terms, options.merge({:facets =>
> [:posted_on]})).inspect
> 
> <snip>
> Jan 01 01:08:40 +0100 1970=>1, Thu Jan 01 01:15:13 +0100 1970=>1, Thu
> Jan 01 01:08:41 +0100 1970=>1, Thu Jan 01 01:06:30 +0100 1970=>1, Thu
> Jan 01 01:10:52 +0100 1970=>1, Thu Jan 01 01:13:03 +0100 1970=>1, Thu
> Jan 01 01:15:14 +0100 1970=>1, Thu Jan 01 01:04:20 +0100 1970=>1, Thu
> Jan 01 01:06:31 +0100 1970=>1, Thu Jan 01 01:10:53 +0100 1970=>1, Thu
> Jan 01 01:15:15 +0100 1970=>1, Thu Jan 01 01:10:54 +0100 1970=>1, Thu
> Jan 01 01:04:21 +0100 1970=>1, Thu Jan 01 01:06:32 +0100 1970=>1, Thu
> Jan 01 01:08:43 +0100 1970=>1, Thu Jan 01 01:15:16 +0100 1970=>1}}
> 
> Is there something I need to do to cast this specifically to a Date? I
> suspect this is related to MySQL as the times must be stored as
> data...
> 
> Many thanks - Kris.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Thinking Sphinx" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/thinking-sphinx?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to