Indexing Error in Getting Started with Picky

45 views
Skip to first unread message

Neil Panjwani

unread,
Jul 30, 2012, 12:43:42 AM7/30/12
to picky...@googlegroups.com
I ran into a few issues while trying to run the example in the Getting Started section here: http://florianhanke.com/picky/getting_started.html
The generated picky server failed to bundle (due to a lack of a Gemfile) and the indexing rake task threw a TypeError complaining about symbols and strings. See below.

➜  mkdir picky_test
➜  cd picky_test
➜  picky_test  picky generate server picky_server
Setting up Picky Sinatra Server "picky_server".
/Users/neil/work/picky_test/picky_server created.
/Users/neil/work/picky_test/picky_server/app.rb created.
/Users/neil/work/picky_test/picky_server/log created.
/Users/neil/work/picky_test/picky_server/log/README created.
/Users/neil/work/picky_test/picky_server/log/unicorn.stderr.log created.
/Users/neil/work/picky_test/picky_server/log/unicorn.stdout.log created.
/Users/neil/work/picky_test/picky_server/Rakefile created.
/Users/neil/work/picky_test/picky_server/spec created.
/Users/neil/work/picky_test/picky_server/spec/integration_spec.rb created.
/Users/neil/work/picky_test/picky_server/config.ru created.
/Users/neil/work/picky_test/picky_server/data created.
/Users/neil/work/picky_test/picky_server/data/development created.
/Users/neil/work/picky_test/picky_server/data/development/library.csv created.
/Users/neil/work/picky_test/picky_server/data/production created.
/Users/neil/work/picky_test/picky_server/data/production/library.csv created.
/Users/neil/work/picky_test/picky_server/data/test created.
/Users/neil/work/picky_test/picky_server/data/test/library.csv created.
/Users/neil/work/picky_test/picky_server/logging.rb created.
/Users/neil/work/picky_test/picky_server/spec exists, skipping.
/Users/neil/work/picky_test/picky_server/spec/spec_helper.rb created.
/Users/neil/work/picky_test/picky_server/tmp created.
/Users/neil/work/picky_test/picky_server/tmp/pids created.
/Users/neil/work/picky_test/picky_server/tmp/pids/README created.
/Users/neil/work/picky_test/picky_server/unicorn.rb created.
"picky_server" is a great project name! Have fun :)

Next steps:
1. cd picky_server
2. rake index
3. unicorn -c unicorn.rb
4. rake todo      # (optional) shows you where Picky needs input from you
                  #            if you want to define your own search.
➜  picky_test  cd picky_server
➜  picky_server  bundle install
Could not locate Gemfile
➜  picky_server  rake index
Picky is indexing using multiple processes: TTT/Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump': In :compat mode all Hash keys must be Strings or Symbols, not Fixnum. (TypeError)
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json.rb:111:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:38:in `block in dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `open'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:27:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/bundle_indexing.rb:40:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category.rb:83:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category_indexing.rb:45:in `block in cache'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `call'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:187:in `block in create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `fork'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:121:in `spawn'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:140:in `block in run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `loop'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:163:in `block in start_thread'
/Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump': In :compat mode all Hash keys must be Strings or Symbols, not Fixnum. (TypeError)
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json.rb:111:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:38:in `block in dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `open'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:27:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/bundle_indexing.rb:40:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category.rb:83:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category_indexing.rb:45:in `block in cache'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `call'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:187:in `block in create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `fork'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:121:in `spawn'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:140:in `block in run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `loop'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:163:in `block in start_thread'
/Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump': In :compat mode all Hash keys must be Strings or Symbols, not Fixnum. (TypeError)
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json/adapters/oj.rb:18:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/multi_json-1.3.6/lib/multi_json.rb:111:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:38:in `block in dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `open'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:36:in `dump_json'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/backends/memory/json.rb:27:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/bundle_indexing.rb:40:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category.rb:83:in `dump'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/picky-4.6.1/lib/picky/category_indexing.rb:45:in `block in cache'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `call'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/task/callable.rb:23:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:187:in `block in create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `fork'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/process_manager.rb:182:in `create_process'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:121:in `spawn'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:140:in `block in run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `loop'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:136:in `run'
from /Users/neil/.rvm/gems/ruby-1.9.2-p290/gems/procrastinate-0.4.1/lib/procrastinate/scheduler.rb:163:in `block in start_thread'
 Done in 1s.

I'm running on Ruby 1.9.2:

➜  picky_server  ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]

Any thoughts?

Picky / Florian Hanke

unread,
Jul 30, 2012, 2:08:40 AM7/30/12
to picky...@googlegroups.com
Hi Neil,

Thanks for the detailed report.

1. The server does indeed not contain a Gemfile. The reason is that the gem itself already loads all the necessary gems and the Picky server uses the true and testes gem mechanism (and I wanted to have the user decide whether they want to add it). However, I could update it to use a Gemfile, thanks for the pointer.
2. Picky now uses multi_json to save hashes onto disk. However, one of the adapted JSON libs, OJ seems to have trouble using Fixnums. One solution is to switch to the faster yajl-ruby lib. Just gem install yajl-ruby and multi_json should use that one. If it doesn't, run MultiJson.use(:yajl) at the beginning of your app.rb.

I hope that helps, cheers,
   Florian

Neil Panjwani

unread,
Jul 30, 2012, 1:57:41 PM7/30/12
to picky...@googlegroups.com
Thanks for the quick response.

I installed the yajl-ruby gem, but I had to manually add MultiJson.use(:yajl) to app.rb to get it to work. All set now, thanks.

- Neil

Picky / Florian Hanke

unread,
Jul 30, 2012, 8:54:50 PM7/30/12
to picky...@googlegroups.com
Thanks for the info. Glad to hear it works. I'll contact the multi_json people to see what we can do.
Reply all
Reply to author
Forward
0 new messages