【问题标题】:Is it possible to index embeded objects in MongoDB with Sphinx?是否可以使用 Sphinx 索引 MongoDB 中的嵌入对象?
【发布时间】: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


【解决方案1】:

从 r3518 开始支持 json 属性。 请检查https://code.google.com/p/sphinxsearch/source/detail?r=3518,尤其是 /trunk/test/test_206/test.xml 以了解如何使用它。目前在 json 对象中搜索仍然是实验性的(还不支持子对象)。 不确定这些新属性是否可以与 ruby​​ gem 一起使用。

【讨论】:

    猜你喜欢
    • 2014-02-20
    • 2011-07-11
    • 1970-01-01
    • 1970-01-01
    • 2019-10-13
    • 1970-01-01
    • 2015-08-13
    • 1970-01-01
    • 2014-01-08
    相关资源
    最近更新 更多