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

_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk

Reply via email to