From f028992a18a425e295368d4dad6b3ae5304b5a34 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Fri, 11 Dec 2015 19:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=96=E5=AD=90=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/memo.rb | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/models/memo.rb b/app/models/memo.rb index 2ead1cbb6..ee9f4c8db 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -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