搜索课程

This commit is contained in:
yuanke 2016-10-09 13:16:03 +08:00
parent 1fe2f8946b
commit 9dd6a65316
1 changed files with 11 additions and 0 deletions

View File

@ -2,7 +2,18 @@
class Syllabus < ActiveRecord::Base
include Redmine::SafeAttributes
include ApplicationHelper
#elasticsearch
include Elasticsearch::Model
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_on, index:"not_analyzed", type:'date'
end
end
acts_as_taggable
acts_as_attachable
has_many_kindeditor_assets :assets, :dependent => :destroy