2011-08-05 3 views
0

Unfortunatelly 스핑크스는 단순히ThinkingSphinx,`time` 속성을 설정에 문제

class Place << ActiveRecord::Base 
#... relations 

define_index 
    #... 
    has breakfast_start, :as => breakfast_start 
end 

rake ts:rebuild 속성을 time 필드를 변환 할 수 없습니다 생각 : 또한 해결하지

rake aborted! 

Cannot automatically map attribute breakfast_start in Place 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 

(See full trace by running task with --trace) 

변경 구문 has "CAST(column AS INT)", :type => :integer, :as => :column에 :

ERROR: index 'place_core': sql_range_query: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INT) AS `breakfast_start` FROM `places` 

누구나 고쳐? 미리 감사드립니다.

답변

2

나는 TS의 나쁜 예라고 생각합니다. 대신에 UNSIGNED INT을 사용해보십시오.

+0

와우. 매우 빠르다. 그리고 그것은 작동합니다! 너 락! :디 –

1

추가 생각. 데이터베이스에 색인을 생성하려는 열이 있는지 확인하는 것이 좋습니다. 오류 메시지를 약간 위태롭게 만드는 열이 없으면 동일한 오류가 발생할 수 있습니다.

rake db : migrate를 실행하면 테스트 용으로 prod 복사본을로드했으며이 sphinx delta 열은이 데이터베이스 복사본에 없었습니다.

희망이 있으면 비슷한 문제가있는 다른 사용자에게 도움이되기를 바랍니다.