From philip at prettybycritty.com Sun Feb 1 10:49:05 2009 From: philip at prettybycritty.com (Philip Ingram) Date: Sun, 1 Feb 2009 10:49:05 -0500 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) Message-ID: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> 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? From kraemer at webit.de Sun Feb 1 13:16:53 2009 From: kraemer at webit.de (=?ISO-8859-1?Q?Jens_Kr=E4mer?=) Date: Sun, 1 Feb 2009 19:16:53 +0100 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> Message-ID: 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 > Ferret-talk at rubyforge.org > 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 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From philip at prettybycritty.com Sun Feb 1 16:04:28 2009 From: philip at prettybycritty.com (Philip Ingram) Date: Sun, 1 Feb 2009 16:04:28 -0500 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> Message-ID: <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> 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 >> Ferret-talk at rubyforge.org >> 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 > kraemer at webit.de | www.webit.de > > Amtsgericht Dresden | HRB 15422 > GF Sven Haubold > > > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk From toastkid.williams at gmail.com Fri Feb 6 06:13:43 2009 From: toastkid.williams at gmail.com (Max Williams) Date: Fri, 6 Feb 2009 12:13:43 +0100 Subject: [Ferret-talk] ActsAsFerret - what's the class of the results? Message-ID: I'm trying to write a test for a method that uses a ferret search, but can't validate that the results are a_a_f results because my class test doesn't work. Can anyone set me straight? Here's some console experimentation that shows the root of the problem. >> users = User.find_with_ferret("max", :per_page => 2) => [#> users.size => 2 >> users.next_page #call a ferret-results-specific method => 2 >> users.kind_of?(ActsAsFerret::SearchResults) => false What class should i be testing against, if it's not ActsAsFerret::SearchResults? If i do type on the results i just get Array. -- Posted via http://www.ruby-forum.com/. From ddyordanov at gmail.com Mon Feb 9 19:33:22 2009 From: ddyordanov at gmail.com (Dimitar Yordanov) Date: Tue, 10 Feb 2009 01:33:22 +0100 Subject: [Ferret-talk] uninitialized constant ActsAsFerret (NameError) Message-ID: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> Hi all, I have another problem that I fight with for some time and I could not understand where is the problem. Probably the problem is that I am quite "green" in RR :) I am trying to make the Demo Application that comes with Ferret to work but I guess something with my environment is not OK. I will do apreciate any help. [root at moonlight FerretDemo]# ./script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.2.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... Exiting /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:445:in `load_missing_constant': uninitialized constant ActsAsFerret (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:77:in `const_missing' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:89:in `const_missing' from /var/www/html/staff/FerretDemo/config/environment.rb:56 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:521:in `new_constants_in' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require' ... 21 levels... from /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3 -- Posted via http://www.ruby-forum.com/. From philip at prettybycritty.com Mon Feb 9 20:33:54 2009 From: philip at prettybycritty.com (Philip Ingram) Date: Mon, 9 Feb 2009 20:33:54 -0500 Subject: [Ferret-talk] uninitialized constant ActsAsFerret (NameError) In-Reply-To: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> References: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> Message-ID: <37ABBA8F-6F02-4D8B-B6F2-714418D246BE@prettybycritty.com> Dimitar, it appears you added Acts_as_ferret to your environment.rb file. you shouldn't need that if you are using the latest version. The gem/plugin does that kind of magic for you. get rid of it and see if it works. On 9-Feb-09, at 7:33 PM, Dimitar Yordanov wrote: > Hi all, > I have another problem that I fight with for some time and I could not > understand where is the problem. Probably the problem is that I am > quite > "green" in RR :) > I am trying to make the Demo Application that comes with Ferret to > work > but I guess something with my environment is not OK. > I will do apreciate any help. > > [root at moonlight FerretDemo]# ./script/server > => Booting Mongrel (use 'script/server webrick' to force WEBrick) > => Rails 2.2.2 application starting on http://0.0.0.0:3000 > => Call with -d to detach > => Ctrl-C to shutdown server > ** Starting Mongrel listening at 0.0.0.0:3000 > ** Starting Rails with development environment... > Exiting > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:445:in > `load_missing_constant': uninitialized constant ActsAsFerret > (NameError) > from > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:77:in > `const_missing' > from > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:89:in > `const_missing' > from /var/www/html/staff/FerretDemo/config/environment.rb:56 > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' > from > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:153:in > `require' > from > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:521:in > `new_constants_in' > from > /usr/lib/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/ > dependencies.rb:153:in > `require' > ... 21 levels... > from > /usr/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' > from ./script/server:3 > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk From jk at jkraemer.net Tue Feb 10 03:58:22 2009 From: jk at jkraemer.net (Jens Kraemer) Date: Tue, 10 Feb 2009 09:58:22 +0100 Subject: [Ferret-talk] ActsAsFerret - what's the class of the results? In-Reply-To: References: Message-ID: <869D8E08-97DC-429A-9310-ED8876CED3AC@jkraemer.net> Hi, SearchResults is a *really* thin wrapper around a standard Ruby Array instance. If you really want to check it's a SearchResults instance and not something else, check for Array and whether it behaves like it should by looking at the 'special' methods the SearchResults class adds, maybe like this: assert_equal Array, results.class %w(total_hits current_page per_page total_pages).each {|m| assert results.respond_to?(m.to_sym) } cheers, Jens On 06.02.2009, at 12:13, Max Williams wrote: > I'm trying to write a test for a method that uses a ferret search, but > can't validate that the results are a_a_f results because my class > test > doesn't work. Can anyone set me straight? Here's some console > experimentation that shows the root of the problem. > >>> users = User.find_with_ferret("max", :per_page => 2) > => [# ... > ] >>> users.size > => 2 >>> users.next_page #call a ferret-results-specific method > => 2 >>> users.kind_of?(ActsAsFerret::SearchResults) > => false > > What class should i be testing against, if it's not > ActsAsFerret::SearchResults? If i do type on the results i just get > Array. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From jk at jkraemer.net Tue Feb 10 04:03:33 2009 From: jk at jkraemer.net (Jens Kraemer) Date: Tue, 10 Feb 2009 10:03:33 +0100 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> Message-ID: <6B6FFB4D-A120-4510-A50F-0B122B743091@jkraemer.net> 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 >>> Ferret-talk at rubyforge.org >>> 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 >> kraemer at webit.de | www.webit.de >> >> Amtsgericht Dresden | HRB 15422 >> GF Sven Haubold >> >> >> >> _______________________________________________ >> Ferret-talk mailing list >> Ferret-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ferret-talk > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From jk at jkraemer.net Tue Feb 10 03:51:10 2009 From: jk at jkraemer.net (Jens Kraemer) Date: Tue, 10 Feb 2009 09:51:10 +0100 Subject: [Ferret-talk] uninitialized constant ActsAsFerret (NameError) In-Reply-To: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> References: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> Message-ID: <3F13C7D8-4D13-4560-98D1-0C0D6C6DA033@jkraemer.net> Hi, On 10.02.2009, at 01:33, Dimitar Yordanov wrote: > Hi all, > I have another problem that I fight with for some time and I could not > understand where is the problem. Probably the problem is that I am > quite > "green" in RR :) > I am trying to make the Demo Application that comes with Ferret to > work > but I guess something with my environment is not OK. > I will do apreciate any help. Did you actually install the plugin to vendor/plugins/acts_as_ferret ? The demo app doesn't run out of the box. I used to use svn:externals for this but since the move to git this step is necessary. Cheers, Jens -- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From jk at jkraemer.net Tue Feb 10 04:15:56 2009 From: jk at jkraemer.net (Jens Kraemer) Date: Tue, 10 Feb 2009 10:15:56 +0100 Subject: [Ferret-talk] Wildcard trouble In-Reply-To: <50d6c72a0901061617l14e9248s63fea7330d26cfd0@mail.gmail.com> References: <50d6c72a0901061617l14e9248s63fea7330d26cfd0@mail.gmail.com> Message-ID: <4B3E5C2D-538C-4C17-866A-816EE6483BA4@jkraemer.net> Hi Paul, On 07.01.2009, at 01:17, Paul Lynch wrote: > Hi-- I just ran into an odd situation. If I do a search including > the term: > c* - I get 4 hits > ca* - I get the same 4 documents > co* - I get one new document, not found by c* > > Does anyone know what might be going on, or have suggestions for > debugging? How does your full query look like? Ferret has a built in default limit of 512 for the number of terms wildcard queries (and other MultiTermQueries) can get expanded to. Any more terms matching your criteria will be dropped then, keeping the most relevant 512 terms. You can override this value by specifying a max_terms value when constructing the query via the API: query = WildcardQuery.new(:field, "c*", :max_terms => 1024) you might also try monkey patching the Ferret::Search::MultiTermQuery::default_max_terms method to return your custom limit so you dont need to use the query API to construct your queries (i.e. with aaf which doesn't reliably work with query objects due to the DRb stuff involved). It *might* also be a bug in Ferret - if the above doesn't help, can you reproduce this with a simple test case? cheers, Jens -- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From toastkid.williams at gmail.com Tue Feb 10 05:24:06 2009 From: toastkid.williams at gmail.com (Max Williams) Date: Tue, 10 Feb 2009 11:24:06 +0100 Subject: [Ferret-talk] ActsAsFerret - what's the class of the results? In-Reply-To: <869D8E08-97DC-429A-9310-ED8876CED3AC@jkraemer.net> References: <869D8E08-97DC-429A-9310-ED8876CED3AC@jkraemer.net> Message-ID: <6bf626f3ce0935949a1df8853d8ebc3a@ruby-forum.com> ah ok. i should have thought to just put that same method that i referred to into a 'responds_to' call in my test, like you suggest :) Thanks Jens max -- Posted via http://www.ruby-forum.com/. From ddyordanov at gmail.com Tue Feb 10 19:39:41 2009 From: ddyordanov at gmail.com (Dimitar Yordanov) Date: Wed, 11 Feb 2009 01:39:41 +0100 Subject: [Ferret-talk] uninitialized constant ActsAsFerret (NameError) In-Reply-To: <3F13C7D8-4D13-4560-98D1-0C0D6C6DA033@jkraemer.net> References: <72bff97dbb5ad59327818154ffae859c@ruby-forum.com> <3F13C7D8-4D13-4560-98D1-0C0D6C6DA033@jkraemer.net> Message-ID: <7114d2e84850ec279b6628b188ce16f6@ruby-forum.com> Hi, Yes, this was the problem. I have forgotten to install the plugin to the demo application. Do appreciate your help. Dimitar P.S Actually the application manage to start, but does not work ... for now :) -- Posted via http://www.ruby-forum.com/. From philip at prettybycritty.com Tue Feb 10 23:11:09 2009 From: philip at prettybycritty.com (Philip Ingram) Date: Tue, 10 Feb 2009 23:11:09 -0500 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: <6B6FFB4D-A120-4510-A50F-0B122B743091@jkraemer.net> References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> <6B6FFB4D-A120-4510-A50F-0B122B743091@jkraemer.net> Message-ID: 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 >>>> Ferret-talk at rubyforge.org >>>> 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 >>> kraemer at webit.de | www.webit.de >>> >>> Amtsgericht Dresden | HRB 15422 >>> GF Sven Haubold >>> >>> >>> >>> _______________________________________________ >>> Ferret-talk mailing list >>> Ferret-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/ferret-talk >> >> _______________________________________________ >> Ferret-talk mailing list >> Ferret-talk at rubyforge.org >> 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 > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk From jk at jkraemer.net Wed Feb 11 04:48:24 2009 From: jk at jkraemer.net (Jens Kraemer) Date: Wed, 11 Feb 2009 10:48:24 +0100 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> <6B6FFB4D-A120-4510-A50F-0B122B743091@jkraemer.net> Message-ID: Hi, On 11.02.2009, at 05:11, Philip Ingram wrote: > > no comma, worked like a charm. great :-) > 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. As you can see on github, the last commit to Ferret's code base was on Jan 02 this year: http://github.com/dbalmain/ferret/tree/master I'm personally using aaf in several projects, among them a knowledge management system where search also is a key part of the application, so I'll for sure continue maintenance and development of the plugin (as time permits, which in the last few months for sure has been a problem). Patches are always welcome of course. I also plan to do a major rewrite of the whole plugin as soon as possible. Regarding sphinx - while it might be an ok solution for really simple use cases and also might beat aaf regarding re-indexing time, it simply doesn't suit my needs when it comes to more complex scenarios. Ferret is much more capable regarding supported queries and IR features in general, and aaf's Rails integration saves you much of the maintenance hassles you mentioned. And you aren't limited to content stored in the database with Ferret and aaf - I have a project where I crawl static html via rdig and index a product database, and all can be searched at once through a simple search form... Cheers, Jens -- 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: From toastkid.williams at gmail.com Thu Feb 12 05:42:16 2009 From: toastkid.williams at gmail.com (Max Williams) Date: Thu, 12 Feb 2009 11:42:16 +0100 Subject: [Ferret-talk] "Max pool size" - connection error Message-ID: On our server, which is nginx with an 8-mongrel cluster, and a ferret_server for searching, we get an intermittent error when doing ferret searches - always on the same index (for the User class). I don't know why it's always this same index - it's smaller, with less indexed fields, then some of the other indexes, and is generally unremarkable. When the error occurs, i get this in the log: ### /ebs/www/apps/e_learning_resource/releases/20090205174825/app/controllers/application.rb:97:in `rescue_action': # ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it.): (druby://localhost:9010) /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:198:in `checkout' This seems to be random but my suspicion is that it's to do with mongrel. If you keep doing the same search, you're effectively randomly given a mongrel, which then accesses the ferret server to do the search. So maybe some of the mongrels can connect and some can't? Now, our site isn't very busy (it's a subscriber-only site), so it's unlikely that 6 or more mongrels are trying to do a search at the same time - and looking in the log, before the crash, i can't see any other searches going on. With reference to the pool size, i'm not even sure which database it's talking about - is that ferret's own database, rather than our standard application database? It's at this point that the gaps in my knowledge start to show.... anyway, grateful for any help/advice/insight... thanks max -- Posted via http://www.ruby-forum.com/. From toastkid.williams at gmail.com Fri Feb 13 11:01:08 2009 From: toastkid.williams at gmail.com (Max Williams) Date: Fri, 13 Feb 2009 17:01:08 +0100 Subject: [Ferret-talk] "Max pool size" - connection error In-Reply-To: References: Message-ID: <72772e30ce35e58dcbdebac374b0a4da@ruby-forum.com> Just in case anyone was wondering, or more likely, in case anyone encounters this problem and happens to google to this post, then i fixed it (at least, it hasn't broke yet) by adding this option to the end of my options in config/database.yml: pool: 8 (8 because we have 8 mongrels running) -- Posted via http://www.ruby-forum.com/. From philip at prettybycritty.com Mon Feb 23 20:08:54 2009 From: philip at prettybycritty.com (Philip Ingram) Date: Mon, 23 Feb 2009 20:08:54 -0500 Subject: [Ferret-talk] Two Shared Indices(sp?) in aaf.rb file (for Acts_as_ferret) In-Reply-To: References: <7FC44A06-4D51-43A8-B817-7595C228433B@prettybycritty.com> <34935BC3-30B1-48EC-8EE9-FC413C9477B9@prettybycritty.com> <6B6FFB4D-A120-4510-A50F-0B122B743091@jkraemer.net> Message-ID: Jens, thanks again for the words. i've got one more question regarding searching by associations with aaf. Is it possible? for instance, i have an account model and a forum, with topics and messages. I'd love to search by current_account.topics for instance. Using this shared index, can i do this (mind you it doesn't work so i'm wondering if you have any hints?!?! >> ActsAsFerret::define_index('forumindex', >> :models => { >> current_account.topics => {:fields => [:title]}, >> current_account.messages => {:fields => [:title, :content]} >> }, >> :ferret => { >> :default_fields => [:title, :title, :content] >> } >> ) Thoughts? Addendum: Although current_account is a controller method in application.rb, maybe that's why it won't work. i just don't k now enough to put it in the model however. thanks Phil. On 11-Feb-09, at 4:48 AM, Jens Kraemer wrote: > Hi, > > On 11.02.2009, at 05:11, Philip Ingram wrote: >> >> no comma, worked like a charm. > > great :-) > >> 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. > > As you can see on github, the last commit to Ferret's code base was > on Jan 02 this year: http://github.com/dbalmain/ferret/tree/master > > I'm personally using aaf in several projects, among them a knowledge > management system where search also is a key part of the > application, so I'll for sure continue maintenance and development > of the plugin (as time permits, which in the last few months for > sure has been a problem). Patches are always welcome of course. I > also plan to do a major rewrite of the whole plugin as soon as > possible. > > Regarding sphinx - while it might be an ok solution for really > simple use cases and also might beat aaf regarding re-indexing time, > it simply doesn't suit my needs when it comes to more complex > scenarios. Ferret is much more capable regarding supported queries > and IR features in general, and aaf's Rails integration saves you > much of the maintenance hassles you mentioned. And you aren't > limited to content stored in the database with Ferret and aaf - I > have a project where I crawl static html via rdig and index a > product database, and all can be searched at once through a simple > search form... > > > Cheers, > Jens > > -- > 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 > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk