|
|
|
@ -1254,12 +1254,14 @@ class Project < ActiveRecord::Base
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_project_ealasticsearch_index
|
|
|
|
|
return if Rails.env.development?
|
|
|
|
|
if self.is_public
|
|
|
|
|
self.__elasticsearch__.index_document
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def update_project_ealasticsearch_index
|
|
|
|
|
return if Rails.env.development?
|
|
|
|
|
if self.is_public #如果是初次更新成为公开的情况,会报错,那么这条记录尚未被索引过。没有报错就是更新的其他属性
|
|
|
|
|
begin
|
|
|
|
|
self.__elasticsearch__.update_document
|
|
|
|
@ -1276,6 +1278,7 @@ class Project < ActiveRecord::Base
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def delete_project_ealasticsearch_index
|
|
|
|
|
return if Rails.env.development?
|
|
|
|
|
begin
|
|
|
|
|
self.__elasticsearch__.delete_document
|
|
|
|
|
rescue => e
|
|
|
|
|