Message.search('Hello', :page=> '1', :per_page=>'2')

Today I migrated to ThinkingSphinx 1.3.8. After the migration my code
(that used to work before)
 started throwing the exception shown below.

TypeError (String can't be coerced into Fixnum):
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:186:in `*'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:186:in `offset'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:330:in `client'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:246:in `populate'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:245:in `populate'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:349:in `call'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:349:in `retry_on_stale_index'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:242:in `populate'
  c:/ruby/lib/ruby/gems/1.8/gems/thinking-sphinx-1.3.8/lib/
thinking_sphinx/search.rb:175:in `total_entries'


I have the following gems installed on my machine:
config.gem 'after_commit',    :version => '1.0.5'
config.gem 'delayed_job',     :version => '1.8.4'
config.gem 'thinking-sphinx', :version => '1.3.8', :lib =>
'thinking_sphinx'
config.gem 'ts-delayed-delta',:version => '>= 1.0.0', :lib =>
'thinking_sphinx/deltas/delayed_delta',


It looks like the 'search' method's behaviour has changed slightly in
this release.
Now the 'search' method expects the :per_page attribute to be a
Fixnum. In the prior release
I was able to pass a string with out any problems.

E.g.:

page="1"
per_page="10"

Message.search('foobar', :page=>page, :per_page=>per_page)        #
this will throw an error.
Message.search('foobar', :page=>page, :per_page=>per_page.to_i) # this
will work.

Interestingly page attribute works with strings(as demonstrated above)

For the time being I am coercing the per_page parameter to be an
integer.

--

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