# :single\_index deprecated?

**URL:** <https://www.ruby-forum.com/t/single-index-deprecated/150647>\
**Category:** Ferret\
**Created:** [October 10, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/single-index-deprecated/150647 "2008-10-10T20:34:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [October 10, 2008, 8:34pm UTC](https://www.ruby-forum.com/t/single-index-deprecated/150647/1 "2008-10-10T20:34:18Z")

</div>

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](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](http://projects.jkraemer.net/acts_as_ferret/browser/trunk/plugin/acts_as_ferret/lib/act_methods.rb)

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [October 13, 2008, 6:15pm UTC](https://www.ruby-forum.com/t/single-index-deprecated/150647/2 "2008-10-13T18:15:05Z")

</div>

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  
removed\_email\_address@domain.invalid | [www.webit.de](http://www.webit.de)

Amtsgericht Dresden | HRB 15422  
GF Sven Haubold

---

<div class="post-metadata">

**Author:** ![farfignugen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/f17d59/32.png) [@farfignugen](https://www.ruby-forum.com/u/farfignugen)\
**Post date:** [October 13, 2008, 10:19pm UTC](https://www.ruby-forum.com/t/single-index-deprecated/150647/3 "2008-10-13T22:19:51Z")

</div>

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
