ruby on rails - PgSearch 1.0.0 throws ModelNotMultisearchable error when trying to rebuild from console -
i've got app 4 different models multisearchable, set pg_search_scope; ie:
class episode < activerecord::base include pgsearch # multisearchable :against => [:title, :description] pg_search_scope :search_text, :against => [:title, :description], :using => { :tsearch => {:prefix => true} }
as can see @ 1 point tried setting multiserachable way.
of late there items know should returning not in search results, , thought i'd have rebuild pg_search_documents; that's throwing error:
irb(main):004:0> pgsearch::multisearch.rebuild(show) pgsearch::multisearch::modelnotmultisearchable: pgsearch::multisearch::modelnotmultisearchable /app/vendor/bundle/ruby/2.0.0/gems/pg_search-0.7.3/lib/pg_search/multisearch/rebuilder.rb:6:in `initialize' /app/vendor/bundle/ruby/2.0.0/gems/pg_search-0.7.3/lib/pg_search/multisearch.rb:10:in `new' /app/vendor/bundle/ruby/2.0.0/gems/pg_search-0.7.3/lib/pg_search/multisearch.rb:10:in `block in rebuild' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `block in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:210:in `within_new_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:202:in `transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/transactions.rb:209:in `transaction' /app/vendor/bundle/ruby/2.0.0/gems/pg_search-0.7.3/lib/pg_search/multisearch.rb:8:in `rebuild' (irb):4 /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start' /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>' /app/bin/rails:4:in `require' /app/bin/rails:4:in `<main>' irb(main):005:0>
i thought might because of setup pg_search_scope, set 1 class above multisearch:multisearchable :against => [:title, :description] -- rebuild problems.
i tried manual way of deleting pg_search table , rebuilding that's throwing error:
2.1.0 :010 > show.find_each{ |record| record.update_pg_search_document } show load (4.8ms) select "shows".* "shows" order "shows"."id" asc limit 1000 nomethoderror: undefined method `update_pg_search_document' #<show:0x007fd945a92358> /users/grimm/.rvm/gems/ruby-2.1.0/gems/activemodel-4.0.2/lib/active_model/attribute_methods.rb:439:in `method_missing' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/attribute_methods.rb:155:in `method_missing' /users/grimm/.rvm/gems/ruby-2.1.0/gems/acts_as_follower-0.2.1/lib/acts_as_follower/followable.rb:54:in `method_missing' (irb):10:in `block in irb_binding' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:26:in `block (2 levels) in find_each' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:26:in `each' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:26:in `block in find_each' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:75:in `find_in_batches' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-deprecated_finders-1.0.3/lib/active_record/deprecated_finders/relation.rb:70:in `find_in_batches' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/relation/batches.rb:25:in `find_each' /users/grimm/.rvm/gems/ruby-2.1.0/gems/activerecord-4.0.2/lib/active_record/querying.rb:8:in `find_each' (irb):10 /users/grimm/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:90:in `start' /users/grimm/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands/console.rb:9:in `start' /users/grimm/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:62:in `<top (required)>' bin/rails:4:in `require' bin/rails:4
i've been getting same error while trying rebuild (for first time, installing) via rails command line pgsearch::multisearch.rebuild(professor)
. what's worked me instead rebuilding command line using the alternative approach recommended on github:
rake pg_search:multisearch:rebuild[professor]
this seems work me -- doesn't throw error, , when go rails console after , run pgsearch.multisearch("query")
it's returning result, whereas before returning error.
i know isn't fix, it's solution immediate problem. hope helps -- posting issue on github might lead fuller fix.
Comments
Post a Comment