Problem with mysql "date" data type versus "datetime" data type

7 views
Skip to first unread message

Alex Caudill

unread,
Dec 28, 2008, 8:23:31 AM12/28/08
to Thinking Sphinx
Hey guys,

Using the latest revision from github as of now, rake ts:in throws an error
attempting to index "dob DATE" column. Is this a limitation of Sphinx, or
a problem with Thinking Sphinx? No big deal, I've just modified my table
to use "dob DATETIME", but I thought it was worth mentioning. This is
using MySQL 5 btw.

This breaks rake ts:in -

define_index do
#...
has dob
end

While this allows ts:in to work but doesn't return proper results:

e.g., using :conditions => {:dob => 25.years.ago..15.years.ago }
will return an empty array when there should be matching results.

define_index do
#...
indexes dob
end

When the dob column is a "DATETIME", the above conditions hash
works fine.

Here's the relevant part of the backtrace:

rake aborted!
nil is not a symbol

lib/thinking_sphinx/index.rb:418:in `send'
lib/thinking_sphinx/index.rb:418:in `set_source_attributes'
lib/thinking_sphinx/index.rb:416:in `each'
lib/thinking_sphinx/index.rb:416:in `set_source_attributes'
lib/thinking_sphinx/index.rb:64:in `to_riddle_for_core'
lib/thinking_sphinx/active_record.rb:153:in `to_riddle_for_core'
site_ruby/1.8/rubygems/custom_require.rb:31:in `each_with_index'
lib/thinking_sphinx/active_record.rb:150:in `each'
lib/thinking_sphinx/active_record.rb:150:in `each_with_index'
lib/thinking_sphinx/active_record.rb:150:in `to_riddle_for_core'
lib/thinking_sphinx/active_record.rb:126:in `to_riddle'
lib/thinking_sphinx/configuration.rb:125:in `build'
rubygems/custom_require.rb:31:in `each_with_index'
lib/thinking_sphinx/configuration.rb:124:in `each'
lib/thinking_sphinx/configuration.rb:124:in `each_with_index'
lib/thinking_sphinx/configuration.rb:124:in `build'
vendor/plugins/thinking-sphinx/tasks/thinking_sphinx_tasks.rb:60

Pat Allan

unread,
Dec 28, 2008, 11:34:04 PM12/28/08
to thinkin...@googlegroups.com
Hi Alex

It is a limitation in Thinking Sphinx, although I would like to have
it working soon... now that the refactor is out, I guess it's higher
on my priority list now :)

--
Pat
Reply all
Reply to author
Forward
0 new messages