太阳黑子与 jruby
您好,sunspot 可以与 jruby 一起使用吗,这也是我的应用程序详细信息
jruby-1.6.1
rails 3.0.7
when i install all the gems and run rake sunspot:solr:start it gives me the following error
Gem::LoadError: Could not find RubyGem sunspot (>= 0)
report_activate_error at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:861
activate at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:255
gem at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:1215
(root) at /Users/dpatel/.rvm/gems/jruby-1.6.1@solr/bin/sunspot-solr:18
但是,当我运行 rake sunspot:solr:run 时,它工作正常。
另外,当我使用 Model.search 进行搜索时,它工作正常,但是当我在浏览器上启动 solr webapp 并搜索某些内容时,它不起作用。
谁能告诉我发生了什么事,对太阳黑子来说是新的。
-谢谢
Hi can sunspot be used with jruby, also here is my app details
jruby-1.6.1
rails 3.0.7
when i install all the gems and run rake sunspot:solr:start it gives me the following error
Gem::LoadError: Could not find RubyGem sunspot (>= 0)
report_activate_error at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:861
activate at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:255
gem at /Users/dpatel/.rvm/rubies/jruby-1.6.1/lib/ruby/site_ruby/1.8/rubygems.rb:1215
(root) at /Users/dpatel/.rvm/gems/jruby-1.6.1@solr/bin/sunspot-solr:18
However when I run rake sunspot:solr:run, it works fine.
Also, when i search using Model.search, it works fine, but I when I fire up solr webapp on the browser and search something, it does not work.
Can anyone tell me what is happening, new to sunspot.
-Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
嗨,我有点明白了,我在 jruby 上,jruby 上不允许 fork,并且 rake sunspot:solr:start 尝试 fork 并抛出错误,但是
rake sunspot:solr:run 在前台启动 solr 并且工作正常,有点痛苦,但一切都很好:-)
-D
Hi i kinda figured it out, i am on jruby and fork is not allowed on jruby, and rake sunspot:solr:start tries to fork and thrown out an error but
rake sunspot:solr:run starts solr in the foreground and works fine, a little painful but all is well :-)
-D
您已经解决了分叉问题,因此,如果您想留在单个 shell 中进行开发和测试,我发现这些别名对于在特定的 Rails 环境中运行 sunspot 并在完成后查找并终止该进程特别有用:
如果保留默认端口:
如果更改端口,则需要更改自动生成的 sunspot.yml 或将 sunspot.rb 放入 config>initializers 中,并且可以在之前添加 -p{$port_num} &在运行别名上并将终止别名的显式端口号更改为 {$port_num}。
正如弗拉德提到的,从你的解释中很难知道浏览器中发生了什么。如果您是 sunspot 的新手,那么您可能会遇到的一件事是,在尝试对数据库中的任何内容进行 CRUD 之前,您需要在开发环境中运行一个实例(使用 sunspot_run_dev 别名),否则您将收到连接被拒绝的错误。
请参阅 bash 函数无法识别的 bash 别名:sunspot_rails、jruby、rspec,了解使用函数包装需要的命令的更多故障排除太阳黑子。
You already figured out the forking issue, so if you want to stay in a single shell for development and testing I found these aliases to be particularly useful for running sunspot in a particular rails environment and then finding and killing that process when I am done:
If you keep the default ports:
If you change ports you will need to change the auto-generated sunspot.yml or put a sunspot.rb in config>initializers and you can add a -p{$port_num} before the & on the run aliases and change the explicit port numbers to {$port_num} for the kill aliases.
As Vlad mentioned, it's hard to know what's going on with in the browser from your explanation. One thing that can catch you if you are new to sunspot is that you need to have an instance running in dev environment (use the sunspot_run_dev alias) before you try to CRUD anything in your database or you will get an connection refused error.
See bash aliases not recognized by a bash function: sunspot_rails, jruby, rspec for some more troubleshooting with functions to wrap commands that require sunspot.
对于耙子问题:
对于“在浏览器中不起作用”:它不起作用是什么意思?
您可以通过比较您在脚本/控制台上手动发出的 Solr 请求与服务器发出的请求来调试它。默认情况下,sunspot gem 在“logs/sunspot-solr-development.log”
For rake issue:
For 'does not work in browser': what do you mean it does not work?
You can debug it by comparing Solr requests made by you manually on script/console and the ones made by the server. By default, the sunspot gem logs requests in 'logs/sunspot-solr-development.log'