【发布时间】:2014-10-03 06:50:58
【问题描述】:
我有一个产品表和一个变体表
Product - title, description, id
Variant - id, product_id, size_label, qty, price
Product has_many variants
Variant belongs_to product
我已经定义了我的产品索引,比如
ThinkingSphinx::Index.define :product, :with => :active_record, delta: true do
indexes title, facet: true
indexes variants.size_label, as: :sizelabel, facet: true
has variants.id, as: :variant_ids
has variants.qty, as: :variant_qty
end
如果我的产品有 5 个变体,例如 size_label S、M、L、XL、XXL,那么 sizelabel 方面将作为一个字符串“S M L XL XXL”返回
我是否设置了错误的索引 - 期望变体作为单独的哈希返回(就像其他方面一样)
使用 Rails 3.2.19、Sphinx 2.1.9、Thinking Sphinx 3.1.1
【问题讨论】:
标签: ruby-on-rails thinking-sphinx