全站搜索
This commit is contained in:
parent
3d9f632105
commit
e710f443c2
|
@ -119,8 +119,9 @@ class Attachment < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort:{
|
sort:{
|
||||||
downloads: {order:"desc"},
|
_score:{order:"desc"},
|
||||||
_score:{order:"desc"}
|
downloads: {order:"desc"}
|
||||||
|
|
||||||
},
|
},
|
||||||
highlight: {
|
highlight: {
|
||||||
pre_tags: ['<span class="c_red">'],
|
pre_tags: ['<span class="c_red">'],
|
||||||
|
|
|
@ -122,8 +122,9 @@ class Course < ActiveRecord::Base
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
updated_at:{order:"desc"},
|
_score:{order: "desc" },
|
||||||
_score:{order: "desc" }
|
updated_at:{order:"desc"}
|
||||||
|
|
||||||
},
|
},
|
||||||
highlight: {
|
highlight: {
|
||||||
pre_tags: ['<span class="c_red">'],
|
pre_tags: ['<span class="c_red">'],
|
||||||
|
@ -393,13 +394,20 @@ class Course < ActiveRecord::Base
|
||||||
# __elasticsearch__.delete_document
|
# __elasticsearch__.delete_document
|
||||||
# end
|
# end
|
||||||
def create_course_ealasticsearch_index
|
def create_course_ealasticsearch_index
|
||||||
|
if self.is_public == 1
|
||||||
self.__elasticsearch__.index_document
|
self.__elasticsearch__.index_document
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def update_course_ealasticsearch_index
|
def update_course_ealasticsearch_index
|
||||||
|
if self.is_public == 1
|
||||||
self.__elasticsearch__.update_document
|
self.__elasticsearch__.update_document
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def delete_course_ealasticsearch_index
|
def delete_course_ealasticsearch_index
|
||||||
|
|
||||||
|
if self.is_public == 1
|
||||||
self.__elasticsearch__.delete_document
|
self.__elasticsearch__.delete_document
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -194,8 +194,8 @@ class Project < ActiveRecord::Base
|
||||||
multi_match: {
|
multi_match: {
|
||||||
query: query,
|
query: query,
|
||||||
type:"most_fields",
|
type:"most_fields",
|
||||||
operator: "and",
|
operator: "or",
|
||||||
fields: ['name']
|
fields: ['name','description^0.5']
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
|
|
|
@ -36,7 +36,6 @@ class User < Principal
|
||||||
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
|
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
|
||||||
indexes :lastname, 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, analyzer: 'smartcn',index_options: 'offsets',type: 'date'
|
||||||
indexes :id, analyzer: 'smartcn',index_options: 'offsets'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue