spec/models/article.rb in mongoid-elasticsearch-0.3.0 vs spec/models/article.rb in mongoid-elasticsearch-0.3.1
- old
+ new
@@ -2,15 +2,20 @@
include Mongoid::Document
include Mongoid::Timestamps::Short
include ActiveModel::ForbiddenAttributesProtection
field :name
+
+ include Mongoid::Slug
+ slug :name
+
field :tags
include Mongoid::Elasticsearch
i_fields = {
name: {type: 'string', analyzer: 'snowball'},
- raw: {type: 'string', index: :not_analyzed}
+ raw: {type: 'string', index: :not_analyzed},
+ _slugs: {type: 'string', index: :not_analyzed}
}
if Gem::Version.new(::Elasticsearch::Client.new.info['version']['number']) > Gem::Version.new('0.90.2')
i_fields[:suggest] = {type: 'completion'}
end