优化排序参数

用于排序的字段最好不要分词
不然就是多值字段的排序会浪费大量的内存
This commit is contained in:
lizanle 2015-12-09 12:57:25 +08:00
parent 6c02115f3f
commit 2fbad38522
5 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ class Attachment < ActiveRecord::Base
settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :filename, analyzer: 'smartcn',index_options: 'offsets'
indexes :downloads, analyzer: 'smartcn',index_options: 'offsets'
indexes :downloads, index:"not_analyzed",index_options: 'offsets'
end
end

View File

@ -16,7 +16,7 @@ class Course < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, analyzer: 'smartcn',index_options: 'offsets',type:"date"
indexes :updated_at, index:"not_analyzed",type:"date"
end
end

View File

@ -22,7 +22,7 @@ class Memo < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :subject, analyzer: 'smartcn',index_options: 'offsets'
indexes :content, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_at, type:'date'
indexes :updated_at,index:"not_analyzed" ,type:'date'
end
end

View File

@ -39,7 +39,7 @@ class Project < ActiveRecord::Base
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets', type:'date'
indexes :updated_on, index:"not_analyzed", type:'date'
end
end

View File

@ -35,7 +35,7 @@ class User < Principal
indexes :login, analyzer: 'smartcn',index_options: 'offsets'
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
indexes :lastname, analyzer: 'smartcn',index_options: 'offsets'
indexes :last_login_on, analyzer: 'smartcn',index_options: 'offsets',type: 'date'
indexes :last_login_on, index:"not_analyzed",type: 'date'
end
end