:single_index deprecated?

I noticed that the :single_index option is no longer listed in the
documentation for AAF, specifically in lib/acts_methods.rb [1]

Furthermore, after an upgrade from a rather old version of AAF, I notice
that the index (after reindexing) is no longer in
RAILS_ROOT/index/RAILS_ENV/shared, but instead split out into separate
directories for each model. What changed?

Thanks,
-chris

[1] Notice it’s still listed as an option here:
http://actsasferret.rubyforge.org/classes/ActsAsFerret/ActMethods.html
but not at
http://projects.jkraemer.net/acts_as_ferret/browser/trunk/plugin/acts_as_ferret/lib/act_methods.rb

Hi!

On 10.10.2008, at 20:34, Chris G. wrote:

I noticed that the :single_index option is no longer listed in the
documentation for AAF, specifically in lib/acts_methods.rb [1]

Furthermore, after an upgrade from a rather old version of AAF, I
notice
that the index (after reindexing) is no longer in
RAILS_ROOT/index/RAILS_ENV/shared, but instead split out into separate
directories for each model. What changed?

:single_index isn’t supported any more.

With current trunk the preferred way to declare an index is via the
ActsAsFerret::define_index method, in a file called config/aaf.rb.
There you may declare several classes using the same index like this:

ActsAsFerret.define_index(‘my_index’,
:models => {
OneModel => {
:fields => {
:title => { :boost => 2 },
:description => { }
},
:if => Proc.new { |r| r.published? }
},
AnotherModel => {
:fields => {
:title => { :boost => 2 },
:another_field => {},
},
:if => Proc.new { |r| r.should_index? }
}, :ferret => {
:default_field => %w( title description
another_field )
})

No need to call acts_as_ferret inside your model anymore (though it
will still work for the one index per class scenario).
my_index is the name of the index, to be used with ActsAsFerret::find:

ActsAsFerret::find(“some query”, ‘my_index’)

to only search records of a given class, find_with_ferret works as
expected:

OneModel.find_with_ferret(‘some query’)

Sorry for not documenting this stuff better…

cheers,
Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49351467660 | Telefax +493514676666
[email protected] | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold

Thanks for the update, Jens. Unfortunately, it looks like I’ll have to
stick with the stable branch for now - these changes in trunk don’t
jive well with my apps.

Thanks and keep up the great work!

-chris