2012-01-03 2 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 

I을 이 문제를 해결하는 방법을 알 수 없습니다.

다음
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" 
다음

내 모델 (I이 데이터베이스는 너무 끔찍한 컨벤션 나를 뛰어하지 않는 설정하지 않았다주의)

대답 모델의 set_primary_key "QTLID는"pirmary ID는 ID

없는 모델에게
+0

대답 : set_primary_key 모델에서 pirmary ID가 ID가 아님을 모델에 알리기 위해 "QTLID" – bdeonovic

답변

1

모델의 set_primary_key "QTLID"나는를 pirmary 그 모델에게 D가 ID가 아님