Hey Pat, thanks for the insights.

I'm using PostgreSQL and tried the snippets you provided, but thinking
sphinx can't generate the config file. I'm googling to see if this SQL
statement is valid in PostgreSQL.

And I'm not using the 'time' attribute, only 'date'.

Cheers.

--
Murilo Soares Pereira
http://www.comp.ufscar.br/~murilo

On Dec 28, 4:21 am, Pat Allan <[email protected]> wrote:
> Hi Murilo
>
> Then splitting the datetime over two attributes, as I described below, is the 
> best approach... I think you'll need to create SQL snippets for your 
> attributes, maybe something like the following (assuming MySQL):
>
>   has "CAST(DATE_FORMAT(datetime_col, '%Y%m%d') as UNSIGNED)", :type => 
> :integer, :as => :datetime_date
>   has "CAST(DATE_FORMAT(datetime_col, '%H%i%s') as UNSIGNED)", :type => 
> :integer, :as => :datetime_time
>
> And then to get the ordering working nicely, the following should do the job:
>
>   Model.search('foo', :order => 'datetime_date ASC, datetime_time ASC')
>
> This is all theory though - I've not tried it myself, but I think it'll work 
> :)
>
> --
> Pat
>
> On 28/12/2009, at 5:13 PM, Murilo Soares Pereira wrote:
>
>
>
> > Hey Pat, replying quickly as usual.
>
> > What I want is that the model that has the 'date' type field can be
> > ordered, example: Model.search("foo", :order => "date_field ASC").
>
> > --
> > Murilo Soares Pereira
> >http://www.comp.ufscar.br/~murilo
>
> > On Dec 27, 11:00 pm, Pat Allan <[email protected]> wrote:
> >> I've not got a solution into TS for this yet... but your email just got me 
> >> thinking, would it work to have two integer attributes - one for the date, 
> >> one for the time - eg: 20091228 and 115340233. Then you could sort by date 
> >> and then time. And I think in the vast majority of cases, people won't 
> >> want to filter on times, just dates...
>
> >> Although, are you wanting the text representations of dates to be 
> >> searchable by users? Or do you want to filter on them? For the latter, 
> >> attributes is what's needed, but otherwise, definitely go with fields, as 
> >> you've already found.
>
> >> --
> >> Pat
>
> >> On 28/12/2009, at 6:32 AM, Murilo Soares Pereira wrote:
>
> >>> The only solution that I can think of is storing date values as
> >>> strings, and them indexing them as fields, rather than attributes.
> >>> Then they wouldn't be converted to UNIX timestamps.
>
> >>> I think I'll do that now.
>
> >>> On Dec 27, 5:22 pm, Murilo Soares Pereira <[email protected]>
> >>> wrote:
> >>>> Do we have any advances on this subject? I did a little googling and
> >>>> didn't found any answers to that issue.
>
> >>>> --
> >>>> Murilo Soares Pereirahttp://www.comp.ufscar.br/~murilo
>
> >>> --
> >>> Murilo Soares Pereira
> >>>http://www.comp.ufscar.br/~murilo
>
> >>> --
>
> >>> 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 
> >>> athttp://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 
> > athttp://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