帖子搜索

This commit is contained in:
lizanle 2015-12-11 19:34:17 +08:00
parent df1d1a4685
commit f028992a18
1 changed files with 21 additions and 3 deletions

View File

@ -18,10 +18,28 @@ class Memo < ActiveRecord::Base
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
settings index: { number_of_shards: 5 } do
settings index: {
number_of_shards: 5 ,
analysis: {
char_filter: {
and_filter: {
type: "mapping",
mappings: [ "&=> and "]
}
},
analyzer: {
my_analyzer: {
type: 'custom',
tokenizer: 'standard',
filter: ['classic'],
char_filter: ['html_strip']
}
}
}
} do
mappings dynamic: 'false' do
indexes :subject, analyzer: 'smartcn',index_options: 'offsets'
indexes :content, analyzer: 'smartcn',index_options: 'offsets'
indexes :subject, analyzer: 'smartcn',index_options: 'offsets'#, char_filter: 'html_strip'
indexes :content, analyzer:'my_analyzer',index_options: 'offsets',search_analyzer: 'smartcn'
indexes :updated_at,index:"not_analyzed" ,type:'date'
end
end