Sphinx错误:在架构中找不到字段'sphinx_internal_class_name'

时间:2013-09-20 16:58:40

标签: ruby-on-rails sphinx thinking-sphinx

问题

我使用Sphinx Search(2.0.8)在我的Rails 3.2.8 Web应用程序中使用gem Thinking Sphinx(3.0.4,直接来自GitHub上的分支主机)。最近,当我尝试搜索任何内容时,我收到以下错误:

index group_core,project_core,user_core: query error: no field 'sphinx_internal_class_name' found in schema

在线,我发现的建议是运行rake ts:rebuild,我做了,但错误仍然出现。

代码

我的thinking_sphinx.yml文件如下:

development:
 morphology: stem_en
 enable_star: true
 charset_table: "0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
test:
 morphology: stem_en
 enable_star: true
 charset_table: "0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"
production:
 morphology: stem_en
 enable_star: true
 charset_table: "0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F"

我的索引文件位于app>索引下,它们如下:

group_index.rb

ThinkingSphinx::Index.define :group, :with => :active_record do
  indexes :name, :sortable => true
  indexes :description, :sortable => true

  #has post_id, user_id, created_at, updated_at

  set_property :delta => true
end

user_index.rb

ThinkingSphinx::Index.define :user, :with => :active_record do
  indexes :last, :sortable => true
  indexes :first, :sortable => true
  indexes :preferredname, :sortable => true
  indexes :email, :sortable => true

  #has post_id, user_id, created_at, updated_at

  set_property :delta => true
end

project_index.rb

ThinkingSphinx::Index.define :project, :with => :active_record do
  indexes :name, :sortable => true
  indexes :pitch, :sortable => true

  #has post_id, user_id, created_at, updated_at

  set_property :delta => true
end

我已经在线搜索过,我发现的任何内容(重建索引,升级到最新版本的Thinking Sphinx等)都解决了这个问题。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

我很确定在主分支的最近提交中修复了这个错误。你能试试以下吗?

gem 'thinking-sphinx', '~> 3.0.5',
  :git    => 'git://github.com/pat/thinking-sphinx.git',
  :branch => 'master',
  :ref    => '41a248c926'