Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
graces_es6
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
graces_es6
Commits
6eb105fe
Commit
6eb105fe
authored
Nov 03, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新代码
parent
a3ac7721
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
25 deletions
+30
-25
es.py
search/utils/es.py
+7
-2
type_info.py
trans2es/type_info.py
+23
-23
No files found.
search/utils/es.py
View file @
6eb105fe
...
...
@@ -38,10 +38,11 @@ def get_es():
'sniff_on_start'
:
False
,
'sniff_on_connection_fail'
:
False
,
}
new_hosts
=
settings
.
ES
_V2
_HOSTS
new_hosts
=
settings
.
ES
7
_HOSTS
new_es
=
Es
(
hosts
=
new_hosts
,
**
init_args
)
return
new_es
def
es_indices_analyze
(
doc_type
,
body
,
es
):
if
es
is
None
:
es
=
get_es
()
...
...
@@ -55,6 +56,7 @@ def es_indices_analyze(doc_type, body, es):
return
res
def
get_talos_es
():
init_args
=
{
'sniff_on_start'
:
False
,
...
...
@@ -64,12 +66,13 @@ def get_talos_es():
talos_es
=
Es
(
hosts
=
talos_hosts
,
**
init_args
)
return
talos_es
def
get_talos_es6
():
init_args
=
{
'sniff_on_start'
:
False
,
'sniff_on_connection_fail'
:
False
,
}
talos_hosts
=
settings
.
ES
6
_HOSTS
talos_hosts
=
settings
.
ES
7
_HOSTS
talos_es
=
Es
(
hosts
=
talos_hosts
,
**
init_args
)
return
talos_es
...
...
@@ -86,6 +89,7 @@ def get_highlight(fields=[]):
}
return
field_highlight
def
get_highlight_query
(
fields
=
[],
query
=
''
):
field_highlight
=
{
'fields'
:
{
k
:
{
"highlight_query"
:
{
...
...
@@ -108,6 +112,7 @@ def get_highlight_query(fields=[], query=''):
}
return
field_highlight
def
health
():
res
=
{
'status'
:
'red'
,
...
...
trans2es/type_info.py
View file @
6eb105fe
...
...
@@ -333,7 +333,7 @@ def get_type_info_map():
type_info_list
=
[
TypeInfo
(
name
=
'tag'
,
# 圈子
type
=
'
tag
'
,
type
=
'
_doc
'
,
model
=
am
.
Tag
,
query_deferred
=
lambda
:
am
.
Tag
.
objects
.
all
()
.
query
,
get_data_func
=
transfer
.
get_tag
,
...
...
@@ -344,7 +344,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'tagv3'
,
# 圈子
type
=
'
tagv3
'
,
type
=
'
_doc
'
,
model
=
TagV3
,
query_deferred
=
lambda
:
TagV3
.
objects
.
all
()
.
query
,
get_data_func
=
transfer
.
get_tagv3
,
...
...
@@ -355,7 +355,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'itemwiki'
,
# 百科
type
=
'
itemwiki
'
,
type
=
'
_doc
'
,
model
=
am
.
ItemWiki
,
query_deferred
=
lambda
:
am
.
ItemWiki
.
objects
.
select_related
(
'tag'
)
.
query
,
get_data_func
=
transfer
.
get_itemwiki
,
...
...
@@ -367,7 +367,7 @@ def get_type_info_map():
TypeInfo
(
name
=
'newitemwiki'
,
# 项目百科tab
type
=
'
newitemwiki
'
,
type
=
'
_doc
'
,
model
=
item
.
NewItemWiki
,
query_deferred
=
lambda
:
item
.
NewItemWiki
.
objects
.
all
()
.
query
,
get_data_func
=
WikiTab_transfer
.
get_ItemWiki
,
...
...
@@ -378,7 +378,7 @@ def get_type_info_map():
TypeInfo
(
name
=
'collectwiki'
,
# 聚合百科tab
type
=
'
collectwiki
'
,
type
=
'
_doc
'
,
model
=
collect
.
CollectWiki
,
query_deferred
=
lambda
:
collect
.
CollectWiki
.
objects
.
all
()
.
query
,
get_data_func
=
WikiTab_transfer
.
get_CollectWiki
,
...
...
@@ -389,7 +389,7 @@ def get_type_info_map():
TypeInfo
(
name
=
'brandwiki'
,
# 品牌产品tab
type
=
'
brandwiki
'
,
type
=
'
_doc
'
,
model
=
brand
.
BrandWiki
,
query_deferred
=
lambda
:
brand
.
BrandWiki
.
objects
.
all
()
.
query
,
get_data_func
=
WikiTab_transfer
.
get_BrandWiki
,
...
...
@@ -400,7 +400,7 @@ def get_type_info_map():
TypeInfo
(
name
=
'productwiki'
,
# 产品百科tab
type
=
'
productwiki
'
,
type
=
'
_doc
'
,
model
=
product
.
ProductWiki
,
query_deferred
=
lambda
:
product
.
ProductWiki
.
objects
.
all
()
.
query
,
get_data_func
=
WikiTab_transfer
.
get_ProductWiki
,
...
...
@@ -410,7 +410,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'wiki_keyword'
,
# 百科keyword
type
=
'
wiki_keyword
'
,
type
=
'
_doc
'
,
model
=
hot_wiki_keyword
.
Wiki_Keyword
,
query_deferred
=
lambda
:
hot_wiki_keyword
.
Wiki_Keyword
.
objects
.
all
()
.
query
,
get_data_func
=
transfer
.
Wiki_keyword
,
...
...
@@ -421,7 +421,7 @@ def get_type_info_map():
TypeInfo
(
name
=
'diary'
,
# 日记本
type
=
'
diary
'
,
type
=
'
_doc
'
,
model
=
Diary
,
# WARNING:
# This code *MUST* be synchronized with trans2es.utils.transfer.get_diary
...
...
@@ -440,7 +440,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'service'
,
# 福利
type
=
'
service
'
,
type
=
'
_doc
'
,
model
=
am
.
Service
,
query_deferred
=
lambda
:
am
.
Service
.
objects
.
select_related
(
'doctor__hospital__city__province'
)
.
query
,
get_data_func
=
service_transfer
.
get_service
,
...
...
@@ -450,7 +450,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'package'
,
type
=
'
package
'
,
type
=
'
_doc
'
,
model
=
UnitRelateService
,
query_deferred
=
lambda
:
UnitRelateService
.
objects
.
filter
(
related_type
=
VisualUnitRelatedServiceType
.
PACKAGE
)
.
query
,
...
...
@@ -461,7 +461,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'package_promotion'
,
type
=
'
package_promotion
'
,
type
=
'
_doc
'
,
model
=
SubmissionCommodity
,
query_deferred
=
lambda
:
SubmissionCommodity
.
objects
.
all
()
.
query
,
get_data_func
=
package_promotion_transfer
.
get_promotion
,
...
...
@@ -471,7 +471,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'lbs'
,
type
=
'
lbs
'
,
type
=
'
_doc
'
,
model
=
SubmissionCommodity
,
query_deferred
=
lambda
:
SubmissionCommodity
.
objects
.
using
(
settings
.
POSEIDON_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
service_transfer
.
lbs_promotion_info
,
...
...
@@ -481,7 +481,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'lbs_clone'
,
type
=
'
lbs
'
,
type
=
'
_doc
'
,
model
=
UnitRelateService
,
query_deferred
=
lambda
:
UnitRelateService
.
objects
.
using
(
settings
.
POSEIDON_DB_NAME
)
.
all
()
.
query
,
get_data_func
=
service_transfer
.
lbs_unit_info
,
...
...
@@ -491,7 +491,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'sku'
,
# sku
type
=
'
sku
'
,
type
=
'
_doc
'
,
model
=
am
.
ServiceItem
,
query_deferred
=
lambda
:
am
.
ServiceItem
.
objects
.
select_related
(
'service__doctor__hospital__city__province'
)
.
query
,
...
...
@@ -502,7 +502,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'doctor'
,
# 医生
type
=
'
doctor
'
,
type
=
'
_doc
'
,
model
=
am
.
Doctor
,
query_deferred
=
lambda
:
am
.
Doctor
.
objects
.
select_related
(
'hospital__city__province'
)
...
...
@@ -516,7 +516,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'consultant'
,
# 医生
type
=
'
consultant
'
,
type
=
'
_doc
'
,
model
=
counsellor
.
Counsellor
,
query_deferred
=
lambda
:
counsellor
.
Counsellor
.
objects
.
all
()
.
query
,
get_data_func
=
consultation_transfer
.
get_consultant
,
...
...
@@ -526,7 +526,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'user'
,
# 用户
type
=
'
user
'
,
type
=
'
_doc
'
,
model
=
am
.
User
,
query_deferred
=
lambda
:
am
.
User
.
objects
.
select_related
(
'userextra'
)
.
query
,
get_data_func
=
user_transfer
.
get_user
,
...
...
@@ -536,7 +536,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'board'
,
# 问答
type
=
'
board
'
,
type
=
'
_doc
'
,
model
=
RankBoard
,
query_deferred
=
lambda
:
RankBoard
.
objects
.
prefetch_related
(
'data_tags'
)
.
query
,
get_data_func
=
board_transfer
.
get_board
,
...
...
@@ -546,7 +546,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
'user_album'
,
# 用户相册
type
=
'
user_album
'
,
type
=
'
_doc
'
,
model
=
am
.
User
,
query_deferred
=
lambda
:
am
.
User
.
objects
.
select_related
(
'userextra'
)
.
query
,
get_data_func
=
user_album_transfer
.
get_user_album
,
...
...
@@ -556,7 +556,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
"group"
,
# 小组
type
=
"
group
"
,
type
=
"
_doc
"
,
model
=
Group
,
query_deferred
=
lambda
:
Group
.
objects
.
all
()
.
query
,
get_data_func
=
group_transfer
.
get_group
,
...
...
@@ -566,7 +566,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
"topic"
,
# 话题
type
=
"
group
"
,
type
=
"
_doc
"
,
model
=
Topic
,
query_deferred
=
lambda
:
Topic
.
objects
.
all
()
.
query
,
get_data_func
=
grouptopic_transfer
.
get_topic
,
...
...
@@ -576,7 +576,7 @@ def get_type_info_map():
),
TypeInfo
(
name
=
"special"
,
# 话题
type
=
"
special
"
,
type
=
"
_doc
"
,
model
=
SpecialPool
,
query_deferred
=
lambda
:
SpecialPool
.
objects
.
all
()
.
query
,
get_data_func
=
special_transfer
.
get_special
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment