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
回答: set_primary_key模型中的「QTLID」告訴模型pirmary ID不是ID – bdeonovic 2012-01-03 21:46:04