I am using tire (https://github.com/karmi/tire) with mongoid. Here is my model definition:
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
Say I have a document {tags_array: ["hello world"]}. Then the following queries work fine:
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"] }
But the following doesn't return any results:
SomethingWithTag.tire.search { filter :terms, :tags_array => ["hello world"] }
What should I do to make it work?
Edit: here's a small piece of code to test: http://pastebin.com/n1rUtK3e