|
|
|
@ -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'
|
|
|
|
|
indexes :updated_on, analyzer: 'smartcn',index_options: 'offsets', type:'date'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -195,12 +195,12 @@ class Project < ActiveRecord::Base
|
|
|
|
|
query: query,
|
|
|
|
|
type:"most_fields",
|
|
|
|
|
operator: "and",
|
|
|
|
|
fields: ['name','description^0.5']
|
|
|
|
|
fields: ['name']
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
sort: {
|
|
|
|
|
updated_on:{order: "desc" },
|
|
|
|
|
_score:{order: "desc" }
|
|
|
|
|
_score:{order: "desc" },
|
|
|
|
|
updated_on:{order: "desc" }
|
|
|
|
|
},
|
|
|
|
|
highlight: {
|
|
|
|
|
pre_tags: ['<span class="c_red">'],
|
|
|
|
@ -1217,13 +1217,19 @@ class Project < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_project_ealasticsearch_index
|
|
|
|
|
if self.is_public == 1
|
|
|
|
|
self.__elasticsearch__.index_document
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
def update_project_ealasticsearch_index
|
|
|
|
|
if self.is_public == 1
|
|
|
|
|
self.__elasticsearch__.update_document
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
def delete_project_ealasticsearch_index
|
|
|
|
|
if self.is_public == 1
|
|
|
|
|
self.__elasticsearch__.delete_document
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|