Hi,
I’ve added acts_as_ferret on my model and add the field ‘name’ to the
ferret index for the first time. I’m using rails 2.2
acts_as_ferret(:fields => {
:name => {:store => :yes, :boost => 2.0}},
:remote => true,
:ferret => {:analyzer => SpanishAnalyzer.new, :use_compound_file =>
true, :merge_factor => 4})
And when I try to search (and needs to rebuild the index, because it’s
for the first time) I do:
def search
@text = params[:text] || ‘’
@results = Model.paginate_with_ferret(@text,
:total_entries => Model.total_hits(@text), :page => params[:page],
:per_page => 10)
@results ||= []
end
I get the following error when indexes my model:
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:142:in
create_time_zone_conversion_attribute?' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:75:in
define_attribute_methods’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:71:in
each' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:71:in
define_attribute_methods’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/attribute_methods.rb:242:in
method_missing' vendor/plugins/acts_as_ferret/lib/instance_methods.rb:50:in
ferret_enabled?’
vendor/plugins/acts_as_ferret/lib/bulk_indexer.rb:20:in index_records' vendor/plugins/acts_as_ferret/lib/bulk_indexer.rb:20:in
each’
vendor/plugins/acts_as_ferret/lib/bulk_indexer.rb:20:in index_records' vendor/plugins/acts_as_ferret/lib/bulk_indexer.rb:32:in
measure_time’
vendor/plugins/acts_as_ferret/lib/bulk_indexer.rb:18:in index_records' vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:52:in
index_model’
vendor/plugins/acts_as_ferret/lib/class_methods.rb:79:in
records_for_rebuild' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in
transaction’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/transactions.rb:129:in
transaction' vendor/plugins/acts_as_ferret/lib/class_methods.rb:74:in
records_for_rebuild’
vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:51:in
index_model' vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:39:in
index_models’
vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:39:in each' vendor/plugins/acts_as_ferret/lib/ferret_extensions.rb:39:in
index_models’
vendor/plugins/acts_as_ferret/lib/local_index.rb:54:in rebuild_index' vendor/plugins/acts_as_ferret/lib/local_index.rb:31:in
ensure_index_exists’
vendor/plugins/acts_as_ferret/lib/local_index.rb:18:in ferret_index' vendor/plugins/acts_as_ferret/lib/local_index.rb:86:in
total_hits’
vendor/plugins/acts_as_ferret/lib/class_methods.rb:165:in total_hits' app/controllers/model_controller.rb:108:in
search’
I’ve reached to ‘ferret_enabled?’ and seems that it crashes when is
using the aaf_configuration hash, either on the ‘ferret_enabled?’ or in
the ‘to_doc’ method. I’ve searched but I can’t find anything about this
error (with ferret). Any help? Thanks!!