Hi, I had ferret working wonderfully but i am regretting doing a gem update today. I had alot of trouble first installing it and was really happy to have it working. The upgrade was from 0.3.1 to 0.4.0. The problem is; in the rails console,>> @results = Book.find_by_contents("peter pan")=> #<ActsAsFerret::SearchResults:0x487040c @total_hits=0, @results=[]> Its indexing only null values! and in the app(here''s the stack), ArgumentError in SearchController#search wrong number of arguments (1 for 0) RAILS_ROOT: C:/INSTAN~1/rails_apps/clean/config/.. Application Trace | Framework Trace | Full Trace C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:220:in `ferret_enabled?'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:220:in `reindex_model'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:219:in `each'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:219:in `reindex_model'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:217:in `step'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:217:in `reindex_model'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/database_statements.rb:59:in `transaction'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/transactions.rb:95:in `transaction'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:216:in `reindex_model'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:47:in `rebuild_index'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:46:in `each'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:46:in `rebuild_index'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:23:in `ensure_index_exists'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/local_index.rb:9:in `initialize'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:233:in `new'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:233:in `create_index_instance'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:25:in `aaf_index'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:82:in `find_id_by_contents'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:134:in `ar_find_by_contents'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:128:in `find_records_lazy_or_not'' C:/INSTAN~1/ruby/lib/ruby/gems/1.8/gems/acts_as_ferret-0.4.0/lib/class_methods.rb:54:in `find_by_contents'' #{RAILS_ROOT}/app/models/book.rb:100:in `full_text_search'' #{RAILS_ROOT}/app/controllers/search_controller.rb:12:in `search'' Help very much appreciated) -- Posted via http://www.ruby-forum.com/.
On Wed, Jul 04, 2007 at 03:19:29PM +0200, crissy crissy wrote:> Hi, I had ferret working wonderfully but i am regretting doing a gem > update today. > I had alot of trouble first installing it and was really happy to have > it working. The upgrade was from 0.3.1 to 0.4.0.So you''re using acts_as_Ferret 0.4.0 now. What version of Ferret are you running? I''d suggest 0.11.x . Rebuilding your index might help also. How do the pieces of code where you use acts_as_ferret look like? I''m not sure but there may have been some API changes from 0.3.1 to 0.4 . cheers, Jens -- Jens Kr?mer webit! Gesellschaft f?r neue Medien mbH Schnorrstra?e 76 | 01069 Dresden Telefon +49 351 46766-0 | Telefax +49 351 46766-66 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
Jens Kraemer wrote:> On Wed, Jul 04, 2007 at 03:19:29PM +0200, crissy crissy wrote: >> Hi, I had ferret working wonderfully but i am regretting doing a gem >> update today. >> I had alot of trouble first installing it and was really happy to have >> it working. The upgrade was from 0.3.1 to 0.4.0. > > So you''re using acts_as_Ferret 0.4.0 now. What version of Ferret are you > running? I''d suggest 0.11.x . > > Rebuilding your index might help also. How do the pieces of code where > you use acts_as_ferret look like? I''m not sure but there may have been > some API changes from 0.3.1 to 0.4 . > > cheers, > Jens > > > -- > Jens Kr?mer > webit! Gesellschaft f?r neue Medien mbH > Schnorrstra?e 76 | 01069 Dresden > Telefon +49 351 46766-0 | Telefax +49 351 46766-66 > kraemer at webit.de | www.webit.de > > Amtsgericht Dresden | HRB 15422 > GF Sven Haubold, Hagen MalessaHi Jens, Thankyou for your reply. I''m running ferret 0.11.4 The code is just your stock standard AAF stuff(mostly stolen from the railenvy tutorial;-) def search @query = params[:query] if @query.blank? flash[:error] = "Query was blank" redirect_to(:action => ''index'') else @total, @books = Book.full_text_search(@query, :page => (params[:page]||1)) @pages = pages_for(@total) render_cloud @total_hits = Book.total_hits(@query) end end and in the Book Model; def self.full_text_search(q, options = {}) return nil if q.nil? or q=="" default_options = {:limit => 10, :page => 1} options = default_options.merge options # get the offset based on what page we''re on options[:offset] = options[:limit] * (options.delete(:page).to_i-1) # now do the query with our options results = Book.find_by_contents(q, options)#, :conditions => conditions) return [results.total_hits, results] end I''m at a loss as to what to do. -- Posted via http://www.ruby-forum.com/.