# Acts\_as\_ferret - same index in two apps, reindexing issue

**URL:** <https://www.ruby-forum.com/t/acts-as-ferret-same-index-in-two-apps-reindexing-issue/137489>\
**Category:** Ferret\
**Created:** [May 13, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-same-index-in-two-apps-reindexing-issue/137489 "2008-05-13T17:12:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knewter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/cab0a1/32.png) [@knewter](https://www.ruby-forum.com/u/knewter)\
**Post date:** [May 13, 2008, 5:12pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-same-index-in-two-apps-reindexing-issue/137489/1 "2008-05-13T17:12:45Z")

</div>

I’ve got a site that has the main site as well as an admin app. Both of  
them use the same ferret index. Objects from the main site are  
namespaced in the admin site, and those namespaced objects share the  
same db with the main site.

Case in point: class Photo \< ActiveRecord::Base in the main site is  
class MainSite::Photo \< MainSite::Base in the admin site, where  
MainSite::Base specifies the main site’s database. So admin objects  
live in their own db, and main objects are shared between apps.

Anyway, there’s a ferret index on Photos and their categorization scheme  
(Branches, Facets, etc). If I’m on the main site and I update the  
categorization info (add a few tags) for a photo, ferret updates  
immediately. If I do the same thing from the admin site, ferret has to  
be manually reindexed.

Can anyone give me any pointers on why this would be? Are the differing  
class names causing the trouble? I just don’t understand…

Thanks in advance for any help, and I can provide more details as  
requested.

-Josh

---

<div class="post-metadata">

**Author:** ![knewter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/cab0a1/32.png) [@knewter](https://www.ruby-forum.com/u/knewter)\
**Post date:** [May 19, 2008, 10:04pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-same-index-in-two-apps-reindexing-issue/137489/2 "2008-05-19T22:04:04Z")

</div>

Just pinging. This one’s got me stumped.

---

<div class="post-metadata">

**Author:** ![knewter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/cab0a1/32.png) [@knewter](https://www.ruby-forum.com/u/knewter)\
**Post date:** [May 19, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/acts-as-ferret-same-index-in-two-apps-reindexing-issue/137489/3 "2008-05-19T22:06:50Z")

</div>

Oh yes, as an update - the ferret server itself just doesn’t seem to be  
adding to the index on create just with the _one_ app. Sample:

class Term \< ActiveRecord::Base  
acts\_as\_ferret :fields =\> [:name]  
end

> > t=Term.find\_or\_create\_by\_name ‘jail’  
> > =\> #\<Term id: 1, name: “jail”, created\_at: “2008-05-19 19:56:26”,  
> > updated\_at: “2008-05-19 19:56:26”\>
> 
> > Term.find\_by\_contents(‘jail’)  
> > =\> #\<ActsAsFerret::SearchResults:0xb6613a30 @per\_page=0,  
> > @current\_page=nil, @total\_hits=0, @total\_pages=0, @results=[]\>
> 
> > Term.rebuild\_index  
> > =\> nil
> 
> > Term.find\_by\_contents(‘jail’)  
> > =\> #\<ActsAsFerret::SearchResults:0xb6608f54 @per\_page=1,  
> > @current\_page=nil, @total\_hits=1, @total\_pages=1, @results=[#\<Term id:  
> > 1, name: “jail”, created\_at: “2008-05-19 19:56:26”, updated\_at:  
> > “2008-05-19 19:56:26”\>]\>

So creating the term didn’t update the index. I was running it as a drb  
server if that matters at all, and manually rebuilding the index  
succeeds.

Any help?

Josh Adams wrote:

> I’ve got a site that has the main site as well as an admin app. Both of  
> them use the same ferret index. Objects from the main site are  
> namespaced in the admin site, and those namespaced objects share the  
> same db with the main site.
> 
> Case in point: class Photo \< ActiveRecord::Base in the main site is  
> class MainSite::Photo \< MainSite::Base in the admin site, where  
> MainSite::Base specifies the main site’s database. So admin objects  
> live in their own db, and main objects are shared between apps.
> 
> Anyway, there’s a ferret index on Photos and their categorization scheme  
> (Branches, Facets, etc). If I’m on the main site and I update the  
> categorization info (add a few tags) for a photo, ferret updates  
> immediately. If I do the same thing from the admin site, ferret has to  
> be manually reindexed.
> 
> Can anyone give me any pointers on why this would be? Are the differing  
> class names causing the trouble? I just don’t understand…
> 
> Thanks in advance for any help, and I can provide more details as  
> requested.
> 
> -Josh
