-
Notifications
You must be signed in to change notification settings - Fork 801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rails template 03-expert.rb fails #521
Comments
Thanks for the report!, I'm aware of it, and will focus on fixing it in the next weeks, as well as improving the Rails integration in general. The |
It works fine, ... anyway it seems many data are missing. If I remember well, previously it had many articles and different authors as demo data. Now it looks like just one see screenshot here |
So, either delete the app and run the templates again, or re-import the data? If you access the home page at |
... just what I did: Also trying re-import I got the following: $ rake elasticsearch:import:all [IMPORT] Loading models from: /home/lsoave/test/searchapp/app/models rake aborted! NameError: uninitialized constant Article::Searchable /home/lsoave/test/searchapp/app/models/article.rb:9:in `' /home/lsoave/test/searchapp/app/models/article.rb:1:in `' NameError: uninitialized constant Article Tasks: TOP => elasticsearch:import:all (See full trace by running task with --trace) |
Yeah, that's expected :) You have to load the Rails' environment as well:
|
ok I got it ... $ bundle exec rake environment elasticsearch:import:all FORCE=y [IMPORT] Loading models from: /home/lsoave/test/searchapp/app/models [IMPORT] Processing model: Article... [IMPORT] Done ... but sadly I get the same "one article" app. I also notice two things:
Is Redis a pre-requisite now ? Follow the template 03-expert.rb log: Reading articles from gzipped YAML... (0.1ms) begin transaction SQL (0.3ms) INSERT INTO "articles" ("title", "abstract", "content", "url", "shares", "published_on", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?) [["title", "How Y’all, Youse and You Guys Talk"], ["abstract", "What does the way you speak say about where you’re from? Answer the questions to see your personal dialect map."], ["content", ""]..."], ["url", "http://www.nytimes.com/interactive/2013/12/20/sunday-review/dialect-quiz-map.html"], ["shares", 1], ["published_on", "2013-12-20"], ["created_at", "2016-01-22 15:24:44.751902"], ["updated_at", "2016-01-22 15:24:44.751902"]] (70.0ms) commit transaction rake aborted! Redis::CannotConnectError: Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) /home/lsoave/test/searchapp/app/models/concerns/searchable.rb:51:in `block (2 levels) in ' /home/lsoave/test/searchapp/db/seeds.rb:38:in `block in ' /home/lsoave/test/searchapp/db/seeds.rb:37:in `each' /home/lsoave/test/searchapp/db/seeds.rb:37:in `' Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:6379 /home/lsoave/test/searchapp/app/models/concerns/searchable.rb:51:in `block (2 levels) in ' /home/lsoave/test/searchapp/db/seeds.rb:38:in `block in ' /home/lsoave/test/searchapp/db/seeds.rb:37:in `each' /home/lsoave/test/searchapp/db/seeds.rb:37:in `' IO::EINPROGRESSWaitWritable: Operation now in progress - connect(2) would block /home/lsoave/test/searchapp/app/models/concerns/searchable.rb:51:in `block (2 levels) in ' /home/lsoave/test/searchapp/db/seeds.rb:38:in `block in ' /home/lsoave/test/searchapp/db/seeds.rb:37:in `each' /home/lsoave/test/searchapp/db/seeds.rb:37:in `' Tasks: TOP => db:setup => db:seed (See full trace by running task with --trace) |
Ok that's it ! Redis server must be up and running, in order to Sidekiq worker being able to update the index: see room "Add Sidekiq indexer" @line 181 in the new 03-expert template Then, having Redis Server Up & Running is a prerequisite. on Ubuntu 15.10 : $ sudo service redis-server status ● redis-server.service - Advanced key-value store Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled) Active: active (running) since ven 2016-01-22 17:37:51 CET; 13min ago Main PID: 6460 (redis-server) Memory: 6.2M CPU: 1.380s CGroup: /system.slice/redis-server.service └─6460 /usr/bin/redis-server 127.0.0.1:6379 gen 22 17:37:51 basenode systemd[1]: Starting Advanced key-value store... gen 22 17:37:51 basenode systemd[1]: Started Advanced key-value store. |
Thank you, Luca! I appreciate it a lot. And yes, updating the application has been something I've been postponing for far too long, I'm glad I've finally managed to do it. You're correct about Redis having to be up -- I think it makes sense to put some logic into the template to raise a warning when it cannot connect to Redis, to prevent a confusing scenario like you've hit. |
I've added a check for Redis availability into the template in the attached commit. Thanks for raising the issue! |
489ab24 👍 💯 |
running
rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/03-expert.rb
currently result in the following error:
ActionView::Template::Error ... failed to parse search source. unknown search element [facets] ...
see the full log here:
here it is the stack version:
The text was updated successfully, but these errors were encountered: