Thinking_Sphinx 有点麻烦。到白衣:
我有一个餐厅模型和一个具有以下关系的评论模型:
Restaurant Has_many Reviews through relationships
Review belongs_to Restaurant through relationships
每条评论都有一个十进制系统的评分,增量为 0.5。
我在 Thinking Sphinx 中搜索餐馆,并将评论评分设置为如下属性(我这样做是为了按评分值的降序排列结果):
has reviews.rating, :as => :review_rating, :type => :float
这是我在终端中索引 Thinking Sphinx 时遇到的错误:
indexing index 'restaurant_core'...
ERROR: source 'restaurant_core_0': expected attr type ('uint' or 'timestamp' or 'bigint') in sql_attr_multi, got 'float review_rating from field'.
ERROR: index 'restaurant_core': failed to configure some of the sources, will not index.
有趣的故事:当我将 :type 更改为 :integer 时,如下:
has reviews.rating, :as => :review_rating, :type => :integer
我没有收到错误。
我正在运行 Ruby on Rails 3.2.11、Thinking Sphinx 3.0.1、Ubuntu 12.10
任何帮助将不胜感激。