I have spent a couple hours researching the FerretOnRails and acts_as_ferret plugin, and am very pleased with what I see so far. My question is how to have my application, with multiple models: Speakers Talks News etc.. With all varying :string and :text column types, to be able to use a single 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 with a single action like ActiveRecord::find_by_content(''search query test''), would work great. I even seen a reference to the previous post, but haven''t yet figured out how to use this. I read about the Typo integration, that has a Content model, which all other data models (Page, Comment, etc) extend and the Content.find_by_content(@query) is used. This would work, however I do not want to have a "Core" model which is extended in that fashion. But rather have a acts_as_ferrett within each model, all referencing the same index. 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? -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 indexed 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 your 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? Regards Jan Prill On 2/28/06, Nathaniel S. H. Brown <nshb@inimit.com> wrote:> > I have spent a couple hours researching the FerretOnRails and > acts_as_ferret > plugin, and am very pleased with what I see so far. > > My question is how to have my application, with multiple models: > > Speakers > Talks > News > etc.. > > With all varying :string and :text column types, to be able to use a > single > 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 > with > a single action like ActiveRecord::find_by_content(''search query test''), > would work great. I even seen a reference to the previous post, but > haven''t > yet figured out how to use this. > > I read about the Typo integration, that has a Content model, which all > other > data models (Page, Comment, etc) extend and the > Content.find_by_content(@query) is used. This would work, however I do not > want to have a "Core" model which is extended in that fashion. But rather > have a acts_as_ferrett within each model, all referencing the same index. > 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? > > -Nb > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060302/d22ed4d0/attachment-0001.html
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 use Engine.add_index(''Model''), and it will add that model into the search when visiting the search page. However, I have recently realised I can introspect the actual database, and do a Object.const_get(table_name.pluralize).fields_for_ferrett to check if there 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 solidified. Kind regards, Nathan. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Jan Prill > Sent: March 2, 2006 1:16 AM > To: rails@lists.rubyonrails.org > Subject: Re: [Rails] FerretOnRails > > 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 indexed 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 > your 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? > > Regards > Jan Prill > > > On 2/28/06, Nathaniel S. H. Brown <nshb@inimit.com> wrote: > > I have spent a couple hours researching the > FerretOnRails and acts_as_ferret > plugin, and am very pleased with what I see so far. > > My question is how to have my application, with multiple models: > > Speakers > Talks > News > etc.. > > With all varying :string and :text column types, to be > able to use a single > 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 with > a single action like > ActiveRecord::find_by_content(''search query test''), > would work great. I even seen a reference to the > previous post, but haven''t > yet figured out how to use this. > > I read about the Typo integration, that has a Content > model, which all other > data models (Page, Comment, etc) extend and the > Content.find_by_content(@query) is used. This would > work, however I do not > want to have a "Core" model which is extended in that > fashion. But rather > have a acts_as_ferrett within each model, all > referencing the same index. > 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? > > -Nb > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >
Maybe Matching Threads
- How to implement full-text search with OR just like google?
- Canada on Rails - Schedule Released
- Ferret on Rails -- Webrick won''t start?
- Rails 1.1.2: A tiny fix for gem dependencies
- Unable to get the domain in my routes.rb to map custom route tables per domain