I've got an application using Thinking Sphinx 0.9.5. I'm want to order
by the attribute 'created_at' but it isn't working. When I order by
this when doing the search it seems to have no effect (but the search
works otherwise).
I have my index defined like this:
define_index do
indexes name
has created_at
end
And search like this:
@events = Event.search(params[:search],
:match_mode => :extended,
:order => :created_at,
)
When I've logged the output commi
I've done a little bit of debugging and I noticed one thing
suspicious. The sql_query built by TS puts the created_at column in
the select statement. Presumably Sphinx would select something out
like "2008-12-07 02:21:38.050572". However TS defines the attributes
as a "sql_attr_uint = created_at". Wouldn't this result in the string
"2008-12-07 02:21:38.050572" being turned into an integer rather than
the number of seconds since epoch?
I've found this works around the problem.
define_index do
indexes name
indexes 'extract(epoch from effective_at)'
has 'extract(epoch from effective_at)', :as => :epoch, :type
=> :datetime
end
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---