在生产环境中使用 rails 设置 sunspot solr [英] Setup sunspot solr with rails in production environment

查看:65
本文介绍了在生产环境中使用 rails 设置 sunspot solr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了各种链接,但似乎找不到有关创建可在生产中与 Rails 一起使用的正在运行的 solr 实例的好资源.

I have tried various links but I can't seem to find a good resource on creating a running solr instance that works with rails in production.

我知道您必须为生产设置 solr 服务器.我已经尝试使用 tomcat 设置 solr,但似乎无法将其链接到 Rails 应用程序.

I understand that you have to setup the solr server for production. I have tried the setup of solr with tomcat but I cant seem to link it to the rails app.

有什么好的资源可以使用吗?

Is there any good resource out there that I could use?

谢谢

推荐答案

这个博客可以解决你的问题:

This blog may solve your question:

在 CentOS 中使用 Jetty 安装 Solr 4.4,并设置 Solr 服务器以与 Sunspot Gem 配合使用.( http://blogs.pigrider.com/blogs/26 )

Install Solr 4.4 with Jetty in CentOS, and set up Solr server to work with Sunspot Gem. ( http://blogs.pigrider.com/blogs/26 )

以下是博客的部分内容:......

Below are some parts from the blog: ......

8) 将此配置文件 schema.yml 从 Rails 应用程序复制到正在运行的 Solr 4.4 实例的主目录.它将覆盖那里的 Solr 示例配置文件,并将设置 Solr 4.4 服务器以与 Sunspot Gem 一起工作.cp/RailsApplicationPath/Solr/conf/schema.yml/opt/solr/solr/collection1/conf/.

8) Copy this configuration file schema.yml from your Rails application to the home directory of the running Solr 4.4 instance. It will overrider the Solr example configuration file there, and it will set up Solr 4.4 server to work with Sunspot Gem. cp /RailsApplicationPath/Solr/conf/schema.yml /opt/solr/solr/collection1/conf/.

正在运行的 Solr 4.4 实例的主目录是/opt/solr/solr/collection1/.您可以从 Solr 管理页面 http://l o c a l h o s t :8983/solr/admin

The home directory of the running Solr 4.4 instance is /opt/solr/solr/collection1/. You can find this information from Solr admin page http:// l o c a l h o s t :8983/solr/admin

9) 将 version 字段添加到配置文件 schema.yml 中以满足 Solr 4.4 初始化要求.实际上,需要在文件中添加两行代码.它们是:

9) Add version field into the configuration file schema.yml to satisfy Solr 4.4 initialization requirement. Actually, two lines of code need to be added into the file. They are:

<field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>

<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>

配置文件schema.yml最终看起来像:

The configuration file schema.yml eventually will look like:

<schema name="sunspot" version="1.0">
  <types>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
    <!-- *** Other Sunspot fieldType Definitions *** -->
  </types>

  <fields>
    <field name="_version_" type="long" indexed="true" stored="true" multiValued="false"/>
    <!-- *** Other Sunspot field Definitions *** -->
  </fields>

  <!-- *** Other Sunspot Configurations *** -->
</schema>

......

这篇关于在生产环境中使用 rails 设置 sunspot solr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆