Forum: Ruby on Rails FerretOnRails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2006-02-28 18:12
(Received via mailing list)
I have spent a couple hours researching the FerretOnRails and
plugin, and am very pleased with what I see so far.

My question is how to have my application, with multiple models:


With all varying :string and :text column types, to be able to use a
index by which I can produce a search on.

I will go through each of the models and add a acts_as_ferret :fields =>
['text_field', 'string_field', 'etc'] for each of the models so they are
indexed. But as far as storing the data in a way so that I can query it
a single action like ActiveRecord::find_by_content('search query test'),
would work great. I even seen a reference to the previous post, but
yet figured out how to use this.

I read about the Typo integration, that has a Content model, which all
data models (Page, Comment, etc) extend and the
Content.find_by_content(@query) is used. This would work, however I do
want to have a "Core" model which is extended in that fashion. But
have a acts_as_ferrett within each model, all referencing the same
Then have one search page which queries them all, and links to the
controller/show/id for each record result.

Any ideas how I may use the acts_as_ferret to do this?


 Nathaniel S. H. Brown                 
E48d29dc8fedb2878fa518d41cc63d88?d=identicon&s=25 Jan Prill (Guest)
on 2006-03-02 10:16
(Received via mailing list)
Hi, Nathaniel,

I don't remember it exactly but the last time I've looked into jkraemers
Typo integration of acts_as_ferret it was using reflection on the
model and stores the class_name as a field on the index while indexing.
Wouldn't then a query on your model 'x' that puts it's class-name in
query (besides the other fields of that model you want to search on) do
exactly what you want and find only xs because of that class-name?

Jan Prill
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2006-03-02 13:16
(Received via mailing list)
Hey Jan,

The goal was to get a list of all the indexes without knowing what the
models/indexes are. Introspection of the sorts.

I had originally simplified it down to a configuration, which you can
Engine.add_index('Model'), and it will add that model into the search
visiting the search page. However, I have recently realised I can
the actual database, and do a
Object.const_get(table_name.pluralize).fields_for_ferrett to check if
is an index that "should" be created.

If so, then that model will get added. Haven't finalized this yet, but I
promise to release the FerretEngine once I have something a bit more

Kind regards,

 Nathaniel S. H. Brown                 
This topic is locked and can not be replied to.