Thanks Jens,

no comma, worked like a charm.

i now have two shared indexes in aaf.rb.

I'm looking for some reassurance from you and this project. are you still going to maintain it? i'd love to help down the road, if you'd let me of course, as ferret/aaf rebuilds the search index when new items are added, automagically. i'm sure it's more complicated then that of course, however, i don't need to run a rake task and try to guess when i should run it, depending on how busy my site is.

All the hip kids are using sphinx and there was a rumour out there that ferret hasn't been worked on for like 2 years. is that true? if you want to email me directly, i'm fine with that too, but would love to hear about the direction of the project,, and if it's not long term, i might as well go with sphinx, rake tasks and delta indexes and all... i'm launching a new site where search is going to be prevalent in it, hence these questions.

thanks again jens,
keep up the great work.
phil
On 10-Feb-09, at 4:03 AM, Jens Kraemer wrote:

Hi Phillip,

basically what you have there should work if you removed the comma (aaf.rb is a standard ruby file, and each define_index call is just a statement, so a newline or ';' is what you should use for separation of these two calls).

If this doesn't help - what's the exact error you get (and when - at application startup, when indexing or when searching?)

Cheers,
Jens

On 01.02.2009, at 22:04, Philip Ingram wrote:

Hi Jens,

No, but i didn't know that either, so thank you.

What i'm trying is to do the following, All of this code below is in aaf.rb (hopefully the formatting shows up in this email).
ActsAsFerret::define_index('site_index',
:models => {
 Product  => {:fields => [:name, :company]},
 Post    => {:fields => [:title, :body]},
 Prategory => {:fields => [:name]}
},
:ferret   => {
 :default_fields => [:name, :company, :title, :body, :name]
}
),
ActsAsFerret::define_index('forumindex',
:models => {
  Topics => {:fields => [:title]},
  Messages => {:fields => [:title, :content]}
},
:ferret => {
  :default_fields => [:title, :title, :content]
}
)

Now, i get errors when i try to do this, but essentially i want to somehow use 'site_Index' to search those models across all of my site, and only 'forumindex' when i put the search fields on the forum.

IN my Search_controller.rb file i have:
def search
  per_page = 15
@results = ActsAsFerret.find(params[:q], 'site_index', {:page => params[:page], :per_page => per_page}, :conditions => ["account_id = ?", current_account.id] )
end

def forum
  per_page = 30
@results = ActsAsFerret.find(params[:q], 'forumindex', {:page => params[:page], :per_page => per_page})
end

Notice that i have a condition statement for current_account's on site_index. Am i doing this wrong? Is there a better way to add conditions that i'm unaware of?

I do love the benefits of a shared index, but i'm wondering if more then on index can be written at a time?

thoughts?

On 1-Feb-09, at 1:16 PM, Jens Krämer wrote:

Hi,

I'm not sure if this is what you're trying, but having the same model belong to two or more index is impossible with acts_as_ferret.

Cheers,
Jens

On 01.02.2009, at 16:49, Philip Ingram wrote:

Hi all,

I'm trying to add two shared indices to the aaf.rb file, however it is not working. I currently have one shared index, but that index has a condition on it, and i'm not sure how to go about creating another index without this condition in it for my forum, which i want to search only the forum, topics and messages.

Within aaf.rb i tried to comma separate thecode: eg.g

ActsAsFerret::define_index ('one'....), ActsAsFerret::define_index ('two'....)

To no avail.

I also tried to add another aaf2.rb file to the original call when aaf.rb, and include both of these files when aaf.rb is loaded but no dice either.

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


--
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

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


--
Jens Krämer
Finkenlust 14, 06449 Aschersleben, Germany
VAT Id DE251962952
http://www.jkraemer.net/ - Blog
http://www.omdb.org/     - The new free film database

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

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

Reply via email to