太阳黑子solr未定义字段类型

太阳黑子solr未定义字段类型

本文介绍了太阳黑子solr未定义字段类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的黑子和太阳能电池有问题.在开发过程中,它像魔术一样工作,但是在生产中,我从rails生产日志中得到了以下错误:

I'm having a problem with my sunspot and solr. In development it worked like charme but in production I get the following error out of my rails production log:

RSolr :: RequestError(Solr响应:未定义的字段类型): app/controllers/search_controller.rb:7:in'index'

RSolr::RequestError (Solr Response: undefined field type): app/controllers/search_controller.rb:7:in `index'

我想这与schema.xml有关.但是我是个新手.那有人可以帮我吗?

I guess it has something to do with the schema.xml. But I'm quite new to solr. So can anybody help me?

确定:
控制器

OK:
Controller

def index
 unless params[:q].blank?
  @search = Question.search do
    fulltext params[:q]
  end
  @results = @search.results

else
  @results = nil
end
@searchterm = params[:q]

结束

模型(问题)

...

searchable do
  text :title
  text :content
end

推荐答案

听起来您的生产Solr实例未使用Sunspot的schema.xml.

It sounds like your production Solr instance is not using Sunspot's schema.xml.

type字段应在Sunspot的标准schema.xml中定义,该字段用于索引对象的型号名称,以供以后过滤搜索时使用.看到错误消息说type未定义,这对我而言意味着您使用的不是Sunspot的schema.xml.

The type field should defined in Sunspot's standard schema.xml, and it is used to index the model name of the object, for later use in filtering your searches. Seeing an error message saying that type is undefined is what implies to me that you're using a schema.xml other than Sunspot's.

可能是您使用了用于在服务器上安装Solr的方法中的其他一些示例或默认配置集.如果可以,请详细说明如何设置生产Solr服务器.

It could be that you're using some other sample or default set of configurations from the method you used to install Solr on your server. If you can, please elaborate on how you set up your production Solr server.

这篇关于太阳黑子solr未定义字段类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 07:11