【发布时间】:2017-06-14 23:58:58
【问题描述】:
我能否像使用这个 mongodb 命令一样为 ruby 模型中的所有字段创建文本索引:
db.documents.createIndex({ "$**": "text" }, { name: "TextIndex" })
我们也可以以某种方式将数字属性添加到 index.html 中。我试过这样,但它没有
def fulltext_index
attributes.except(:_rev, :_type, :doc_type).values.map{|e| e.class==String ? e.to_s : ""}.join(" ").strip + " " + sequence.to_s
end
index({ fulltext_index: "text"})
【问题讨论】:
标签: ruby-on-rails mongodb elasticsearch mongoid mongoid5