Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Force Encoding Error #10

Closed
nickbender opened this issue Aug 6, 2013 · 1 comment
Closed

Force Encoding Error #10

nickbender opened this issue Aug 6, 2013 · 1 comment

Comments

@nickbender
Copy link

Running into an issue when running bulk updates on existing data.

Whenever a trigram create is attempted on a field with a nil value, I receive the following bomb:

** Execute environment
** Execute fuzzily:bulk_update
Running Router#bulk_update_fuzzy_name
Running Router#bulk_update_fuzzy_dns_name
rake aborted!
undefined method `force_encoding' for nil:Fuzzily::String
/Users/nickbender/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.13/lib/active_support/multibyte/chars.rb:45:in `initialize'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/trigram.rb:22:in `new'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/trigram.rb:22:in `normalize'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/trigram.rb:7:in `trigrams'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/trigram.rb:13:in `scored_trigrams'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/searchable.rb:57:in `block (3 levels) in make_field_fuzzily_searchable'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/searchable.rb:55:in `each'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/searchable.rb:55:in `block (2 levels) in make_field_fuzzily_searchable'
../ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/relation/batches.rb:72:in `find_in_batches'
../ruby-1.9.3-p448/gems/fuzzily-0.2.3/lib/fuzzily/searchable.rb:53:in `block in make_field_fuzzily_searchable'
../services/lib/tasks/fuzzy.rake:21:in `block (4 levels) in <top (required)>'
../services/lib/tasks/fuzzy.rake:19:in `each'
../services/lib/tasks/fuzzy.rake:19:in `block (3 levels) in <top (required)>'
../services/lib/tasks/fuzzy.rake:13:in `each'
../services/lib/tasks/fuzzy.rake:13:in `block (2 levels) in <top (required)>'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:236:in `block in execute'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:175:in `block in invoke_with_call_chain'
../ruby-1.9.3-p448/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_with_call_chain'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:149:in `invoke_task'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `each'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:106:in `block in top_level'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:115:in `run_with_threads'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:100:in `top_level'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:78:in `block in run'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
../ruby-1.9.3-p448@global/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
../ruby-1.9.3-p448@global/bin/rake:23:in `load'
../ruby-1.9.3-p448@global/bin/rake:23:in `<main>'
../ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `eval'
../ruby-1.9.3-p448/bin/ruby_noexec_wrapper:14:in `<main>'

Do all indexed fields have to have a value? If so, is there a way to override or skip this behavior?

@nickbender
Copy link
Author

Catch included in PR #11

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant