2012-02-12 67 views
2

我有一个基于Rails3构建的应用程序,并通过Mongoid与MongoDB对话。 我不想搜索我的一个模型,它是使用狮身人面像的嵌入式孩子。是否可以使用Sphinx在MongoDB中索引嵌入对象?

我使用mongoid-sphinx宝石,设置搜索索引这样

class Foo 

    include Mongoid::Sphinx 
    field :title, :type => String 

    embeds_many :bars 

    search_index(:fields => [:title]) 

end 

是否有可能也对这个嵌入式模型bar定义索引? 让我们假设bar有字符串字段:content

+1

我认为它不可能。我不得不将Bars作为使用引用键的单独集合存储,或者将这个gem分叉并编写我自己的xml-pipe实现 – Johny 2012-02-15 01:05:44

回答

相关问题