2012-02-12 66 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

回答

相關問題