Forum: Ferret strange behavior after switching to DRb server

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D0347a9af192d23f47056bd253743dcf?d=identicon&s=25 John Bachir (Guest)
on 2007-04-02 01:33
(Received via mailing list)
After switching to the DRb server, I am experiencing strange behavior
when sorting on score. My app was working as expected before the switch.

Both before and after the switch, my app sorts properly on other
fields, such as date.

For sorting on score, I am using the following option
find_by_contents option:

:sort => Ferret::Search::SortField::SCORE

Before switching to DRb, this worked very well. Afterward, I see the
error below. (Resource is my model).

Any ideas?

Thanks (again...)
John

---------------------------

RuntimeError in Resource searchController#index

invalid value: <SCORE>


RAILS_ROOT: script/../config/..

(druby://localhost:9010) ./vendor/plugins/acts_as_ferret/lib/
acts_as_ferret.rb:142:in `_load'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:582:in
`load'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/thread.rb:33:in
`exclusive'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:578:in
`load'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:616:in
`recv_request'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:615:in
`recv_request'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:908:in
`recv_request'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1527:in
`init_with_client'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1539:in
`setup_message'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1491:in
`perform'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1586:in
`main_loop'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1582:in
`main_loop'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1578:in
`main_loop'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1427:in
`run'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1424:in
`run'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1344:in
`initialize'
(druby://localhost:9010) /usr/local/lib/ruby/1.8/drb/drb.rb:1624:in
`start_service'
(druby://localhost:9010) ./vendor/plugins/acts_as_ferret/lib/
ferret_server.rb:45:in `start'
(druby://localhost:9010) (eval):55
(druby://localhost:9010) script/runner:3:in `eval'
(druby://localhost:9010) ./vendor/rails/railties/lib/commands/
runner.rb:45
(druby://localhost:9010) script/runner:3
vendor/plugins/acts_as_ferret/lib/remote_index.rb:20:in
`find_id_by_contents'
vendor/plugins/acts_as_ferret/lib/class_methods.rb:82:in
`find_id_by_contents'
vendor/plugins/acts_as_ferret/lib/class_methods.rb:134:in
`ar_find_by_contents'
vendor/plugins/acts_as_ferret/lib/class_methods.rb:128:in
`find_records_lazy_or_not'
vendor/plugins/acts_as_ferret/lib/class_methods.rb:54:in
`find_by_contents'
app/models/resource.rb:126:in `search'
app/controllers/resource_search_controller.rb:68:in `index'
C9dd93aa135988cabf9183d3210665ca?d=identicon&s=25 Jens Kraemer (Guest)
on 2007-04-02 12:16
(Received via mailing list)
On Sun, Apr 01, 2007 at 07:32:35PM -0400, John Bachir wrote:
> After switching to the DRb server, I am experiencing strange behavior
> when sorting on score. My app was working as expected before the switch.
>
> Both before and after the switch, my app sorts properly on other
> fields, such as date.
>
> For sorting on score, I am using the following option
> find_by_contents option:
>
> :sort => Ferret::Search::SortField::SCORE

I had to build custom marshalling routines to support sort fields and it
seems I missed that one.

Adding this line:

return Ferret::Search::SortField::SCORE if string == '<SCORE>'

before line 142 in acts_as_ferret.rb should resolve the issue. Or get
the latest aaf from trunk.


Jens

--
Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
kraemer@webit.de | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa
D0347a9af192d23f47056bd253743dcf?d=identicon&s=25 John Bachir (Guest)
on 2007-04-02 20:52
(Received via mailing list)
On Apr 2, 2007, at 6:16 AM, Jens Kraemer wrote:

> I had to build custom marshalling routines to support sort fields
> and it
> seems I missed that one.
>
> Adding this line:
>
> return Ferret::Search::SortField::SCORE if string == '<SCORE>'
>
> before line 142 in acts_as_ferret.rb should resolve the issue. Or get
> the latest aaf from trunk.


Great, thanks Jens.
This topic is locked and can not be replied to.