2012-02-09 56 views
1

發現我寫這獅身人面像查詢錯誤,沒有場

Network.search :conditions=>{:kind=>'Interest'} 

,我得到這個錯誤

Sphinx Sphinx Daemon returned error: index network_core: query error: no field 'kind' found in schema 

我的模型代碼是

define_index do 
    indexes [name, description], as: :keyword 
    has kind, state 
    end 

我已經運行耙ts:索引和耙ts:開始

+0

運行'耙TS:rebuild' – 2012-02-09 07:29:33

+0

@MikhailNikalyukin同樣的錯誤。 – Victor9663 2012-02-09 07:42:14

+0

將'kind'移動到'indexes' – 2012-02-09 08:36:16

回答

2

您的索引應該尋找這樣的:

define_index do 
    indexes [name, description], as: :keyword 
    indexes kind 
    has state 
end 

這種運行後bundle exec rake ts:rebuild