简体   繁体   English

在Heroku上配置WebSolr

[英]Configuring WebSolr on Heroku

I have get the add on on heroku application, and added required sunspot gem in Gemfile and there is WEBSOLR_URL value in heroku config variables. 我在heroku应用程序上获得了添加,并在Gemfile中添加了必需的黑子宝石,并且heroku配置变量中有WEBSOLR_URL值。

The sunspot.yml has also been added and the production settings is some thing like this production: 还添加了sunspot.yml ,生产设置类似于此生产:

solr:
  hostname: <%=ENV["WEBSOLR_URL"]%>
  port: 8983
  log_level: WARNING

but still search is getting crash on heroku with this error 但仍然搜索在Heroku上因此错误而崩溃

RSolr::Error::Http (RSolr::Error::Http - 404 Not Found
2012-01-18T05:27:31+00:00 app[web.1]: Error: <html><head><title>Apache Tomcat/6.0.28 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /solr/KEY_m0/select</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/solr/a55_m0/select</u></p><p><b>description</b> <u>The requested resource (/solr/KEY_m0/select) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/6.0.28</

PS 聚苯乙烯
I have replaced the actual api key with KEY word. 我已将实际的api键替换为KEY word。

Go to heroku dashboard and open your application. 转到heroku仪表板并打开您的应用程序。 You will have your cobalt add-on there. 您将在那里添加钴。 When you click it for more details it will redirect you to websolr page where you can get your configuration instruction for heroku. 单击它以获取更多详细信息时,它将重定向到websolr页面,您可以在其中获取heroku的配置说明。

以我为例,我只是在websolr索引配置中选择了错误的“索引类型”,因此在选择了我的应用程序实际使用的那个(Sunspot 2.0 for Ruby on Rails)后,该问题得以解决。

I don't think you can embed ERB tags into your sunspot.yml file - the line <%=ENV["WEBSOLR_URL"]%> is probably getting parsed literally. 我认为您不能将ERB标记嵌入到sunspot.yml文件中-行<%=ENV["WEBSOLR_URL"]%>可能已得到字面解析。

I'm looking at my sunspot.yml for a heroku app I'm running, and it looks like I don't really have any settings for production at all. 我正在为运行的heroku应用程序查看sunspot.yml,看来我真的没有任何生产设置。 So long as heroku's WEBSOLR_URL is set correctly, I think that overrides the sunspot.yml anyway. 只要正确设置了heroku的WEBSOLR_URL,我仍然认为它会覆盖sunspot.yml。 I'd try removing that concat tag altogether; 我会尝试完全删除该concat标签; it might be what's tripping things up. 这可能是绊倒的原因。

Some time we might need to change the index type from Heroku Solr dashboard, we need to select - 有时我们可能需要从Heroku Solr仪表板更改索引类型,我们需要选择-

  • sunspot 2.0 for Ruby on Rails (Solr 4) Ruby on Rails的sunspot 2.0(Solr 4)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM