【发布时间】:2012-02-12 20:44:18
【问题描述】:
我有一个基于 Rails3 构建的应用程序,并通过 Mongoid 与 MongoDB 通信。 我不想搜索我的一个模型,它是使用 Sphinx 嵌入的子模型。
我正在使用mongoid-sphinx gem 来设置这样的搜索索引
class Foo
include Mongoid::Sphinx
field :title, :type => String
embeds_many :bars
search_index(:fields => [:title])
end
是否也可以在此嵌入式模型bar 上定义索引?
让我们假设bar 有字符串字段:content。
【问题讨论】:
-
我认为这还不可能。我必须使用引用的键将 Bars 存储为单独的集合,或者分叉这个 gem 并编写我自己的 xml-pipe 实现
标签: ruby-on-rails mongodb mongoid sphinx