Кросс-пост от GitHub :
Мое приложение ищет ссылки в различных сторонних сервисах, таких как Delicious, Twitter ... У меня есть следующий базовый класс:
class Link
include Mongoid::Document
include Tire::Model::Search
include Tire::Model::Callbacks
field :href, type: String
field :name, type: String
mapping do
indexes :href, type: 'string', analyzer: 'url'
indexes :name, type: 'string', analyzer: 'keyword', boost: 10
end
end
и следующий класс наследует от Link
и добавляет еще два поля:
class Link::Delicious < Link
field :tags, type: Array
field :time, type: Time
mapping do
indexes :tags, type: 'string', analyzer: 'keyword'
indexes :time, type: 'date'
end
end
Поиск будет выполняться через Базовый класс: Link.search('google.com')
. Есть ли шанс заставить это работать? В данный момент Tire / ElasticSearch полностью игнорирует (дополнительные) поля в Link::Delicious
.