2012-01-03 151 views
0

回答说: set_primary_key“QTLID”的模型,告诉模型pirmary ID不ID思维狮身人面像:索引错误

我得到这个错误,当我耙:TS指数

Cannot automatically map attribute sphinx_internal_id in QtlTable to an 
equivalent Sphinx type (integer, float, boolean, datetime, string as ordinal). 
You could try to explicitly convert the column's value in your define_index 
block: 
    has "CAST(column AS INT)", :type => :integer, :as => :column 

我无法弄清楚如何解决这个问题。

这里是我的模型(注意我没安装这个数据库,所以不要在我身上跳了可怕的惯例):

class QtlTable < ActiveRecord::Base 
    ... 
    define_index do 
     indexes :QTLID 
     has :QTLName 
    end  
end 

下面是模式看起来像qtl_table:

create_table "qtl_table", :primary_key => "QTLID", :force => true do |t| 
    t.string "QTLName",      :limit => 60,  :default => "", :null => false 
    t.string "Parent_1",     :limit => 60,  :default => "", :null => false 
    t.string "Parent_2",     :limit => 60,  :default => "", :null => false 
    t.string "Heritability",    :limit => 60,  :default => "" 
    t.text "Population_size",    :limit => 16777215 
    t.string "Number_plants_bulked",  :limit => 10 
    t.text "Pop_high_score",    :limit => 16777215 
    t.text "Pop_low_score",    :limit => 16777215 
    t.string "Loci_tested",     :limit => 10,  :default => "" 
    t.string "Intervals_associated",  :limit => 10,  :default => "" 
    t.string "Interval_length",    :limit => 6,  :default => "" 
    t.string "Interval_LOD_score",   :limit => 12,  :default => "" 
    t.string "Interval_P_value",   :limit => 6,  :default => "" 
    t.string "Interval_R2",     :limit => 6,  :default => "" 
    t.string "Genotypic_R2",    :limit => 6,  :default => "" 
    t.text "R2_Definition",    :limit => 16777215 
    t.string "Percent_variation_explained", :limit => 6,  :default => "" 
    t.string "First_entered",    :limit => 60,  :default => "", :null => false 
    t.string "Last_update",     :limit => 60,  :default => "" 
    t.string "TraitName",     :limit => 100,  :default => "" 
    t.binary "in_new",      :limit => 1 
end 

add_index "qtl_table", ["QTLName"], :name => "QTLName_index" 
add_index "qtl_table", ["TraitName"], :name => "TraitName_index" 

答案: set_primary_key模型中的“QTLID”告诉模型表明pirmary ID不是ID

+0

回答: set_primary_key模型中的“QTLID”告诉模型pirmary ID不是ID – bdeonovic 2012-01-03 21:46:04

回答

1

set_primary_key模型中的“QTLID”告诉模型pirmary I D不是ID