2
我正在使用轮胎(https://github.com/karmi/tire)与mongoid。这里是我的模型定义:使用elasticsearch过滤标签与空白
class SomethingWithTag
include Mongoid::Document
include Mongoid::Timestamps
field :tags_array, type: Array
include Tire::Model::Search
include Tire::Model::Callbacks
mapping do
indexes :tags_array, type: :array, index: :not_analyzed
end
end
说我有一个文件{tags_array:[“hello world”]}。那么下面的查询工作的优良:
SomethingWithTag.tire.search { filter :terms, :tags_array => ["hello"] }
SomethingWithTag.tire.search { filter :terms, :tags_array => ["world"] }
SomethingWithTag.tire.search { filter :terms, :tags_array => ["hello", "world"] }
但下面不会返回任何结果:
SomethingWithTag.tire.search { filter :terms, :tags_array => ["hello world"] }
我应该怎么做,使其工作?
编辑:这里的一小块代码来测试:http://pastebin.com/n1rUtK3e
在HTTPS解决:// github上/ karmi/tire/issues/424 – karmi 2012-08-08 07:10:15
顺便说一下,为什么在Github上重复这个问题? – karmi 2012-08-08 07:10:34