Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
search_tips
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
search_tips
Commits
9741f3b4
Commit
9741f3b4
authored
Aug 21, 2020
by
李小芳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'query_type' into 'master'
Query type See merge request
!92
parents
035d8c6a
378f5712
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
38 additions
and
22 deletions
+38
-22
auto_tips.py
search/utils/auto_tips.py
+1
-2
trans2es_data2es_parallel.py
trans2es/management/commands/trans2es_data2es_parallel.py
+0
-1
brandwiki_transfer.py
trans2es/utils/brandwiki_transfer.py
+4
-2
collectwiki_transfer.py
trans2es/utils/collectwiki_transfer.py
+4
-2
doctor_transfer.py
trans2es/utils/doctor_transfer.py
+4
-2
hospital_transfer.py
trans2es/utils/hospital_transfer.py
+4
-2
itemwiki_transfer.py
trans2es/utils/itemwiki_transfer.py
+4
-2
productwiki_transfer.py
trans2es/utils/productwiki_transfer.py
+4
-2
search_query.py
trans2es/utils/search_query.py
+4
-3
tag_transfer.py
trans2es/utils/tag_transfer.py
+5
-2
wordresemble.py
trans2es/utils/wordresemble.py
+4
-2
No files found.
search/utils/auto_tips.py
View file @
9741f3b4
...
...
@@ -204,8 +204,7 @@ def get_query_by_es(query='', lat=0, lng=0, size=0, offset=0, highlight_query=No
ret_list
=
list
()
doctor_hospital_equal_query
=
list
()
tag_equal_query
=
list
()
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
sub_index_name
,
query_body
=
q
,
offset
=
offset
,
size
=
size
,
is_suggest_request
=
True
)
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
sub_index_name
,
query_body
=
q
,
offset
=
offset
,
size
=
size
,
is_suggest_request
=
True
)
for
tips_item
in
result_dict
[
"suggest"
][
"tips-suggest"
]:
for
hit_item
in
tips_item
[
"options"
]:
hit_item
[
"_source"
][
"ori_name"
]
=
hit_item
[
"_source"
][
"ori_name"
]
.
replace
(
"超声刀"
,
"超声提升"
)
...
...
trans2es/management/commands/trans2es_data2es_parallel.py
View file @
9741f3b4
...
...
@@ -68,7 +68,6 @@ class Command(BaseCommand):
try
:
type_info
=
get_type_info_map
()[
type_name
]
query_set
=
type_info
.
queryset
slicer
=
TableSlicer
(
queryset
=
query_set
,
chunk_size
=
type_info
.
bulk_insert_chunk_size
)
for
chunk
in
slicer
.
chunks
():
job
=
Job
(
...
...
trans2es/utils/brandwiki_transfer.py
View file @
9741f3b4
...
...
@@ -23,7 +23,8 @@ class BrandWikiTransfer(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
))
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"brandwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -49,7 +50,8 @@ class BrandWikiTransferV1(object):
item_dict
=
dict
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
),
type_v1
=
True
)
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"brandwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
trans2es/utils/collectwiki_transfer.py
View file @
9741f3b4
...
...
@@ -23,7 +23,8 @@ class CollectWikiTransfer(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
))
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"collectwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -49,7 +50,8 @@ class CollectWikiTransferV1(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
),
type_v1
=
True
)
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"collectwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
trans2es/utils/doctor_transfer.py
View file @
9741f3b4
...
...
@@ -91,7 +91,8 @@ class DoctorTransfer(object):
item_dict
=
dict
()
suggest_list
=
list
()
if
cut_bool
==
False
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"doctor_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
name
=
instance
.
name
,
...
...
@@ -188,7 +189,8 @@ class DoctorTransferV1(object):
item_dict
=
dict
()
suggest_list
=
list
()
if
not
cut_bool
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"doctor_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_doctor_query_word_weight
(
name
=
instance
.
name
,
...
...
trans2es/utils/hospital_transfer.py
View file @
9741f3b4
...
...
@@ -30,7 +30,8 @@ class HospitalTransfer(object):
suggest_list
=
list
()
if
cut_bool
==
False
:
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
name
))
# item_dict["id"] = getMd5Digest(str(name))
item_dict
[
"id"
]
=
"hospital_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
name
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
,
name
=
name
)
...
...
@@ -81,7 +82,8 @@ class HospitalTransferV1(object):
suggest_list
=
list
()
if
cut_bool
==
False
:
item_dict
=
dict
()
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
name
))
# item_dict["id"] = getMd5Digest(str(name))
item_dict
[
"id"
]
=
"hospital_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
name
item_dict
[
"is_online"
]
=
by_hospital_id_judge_office_online
(
is_online
=
instance
.
is_online
,
hospital_id
=
instance
.
id
,
name
=
name
)
...
...
trans2es/utils/itemwiki_transfer.py
View file @
9741f3b4
...
...
@@ -89,7 +89,8 @@ class ItemWikiTransfer(object):
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
))
logging
.
info
(
"get_wiki_query:
%
s,ret_bol:
%
s"
%
(
instance
.
name
,
ret_bol
))
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"itemwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -179,7 +180,8 @@ class ItemWikiTransferV1(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
),
type_v1
=
True
)
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"itemwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
trans2es/utils/productwiki_transfer.py
View file @
9741f3b4
...
...
@@ -23,7 +23,8 @@ class ProduceWikiTransfer(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
))
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"productwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -49,7 +50,8 @@ class ProduceWikiTransferV1(object):
suggest_list
=
list
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
),
type_v1
=
True
)
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"productwiki_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
trans2es/utils/search_query.py
View file @
9741f3b4
...
...
@@ -12,7 +12,6 @@ class SearchWord(object):
@classmethod
def
get_search_query
(
self
,
instance
):
try
:
ret_list
=
list
()
item_dict
=
dict
()
...
...
@@ -22,7 +21,8 @@ class SearchWord(object):
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
sub_query
)
is_online
=
False
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
keyword
)
# item_dict["id"] = getMd5Digest(keyword)
item_dict
[
"id"
]
=
"search_query_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
keyword
total_num
=
QueryWordAttr
.
get_search_query_results_num
(
keyword
)
if
total_num
>
3
:
...
...
@@ -55,7 +55,8 @@ class SearchWord(object):
keyword
=
str
(
sub_query
)
.
lower
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
sub_query
,
type_v1
=
True
)
if
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
keyword
)
# item_dict["id"] = getMd5Digest(keyword)
item_dict
[
"id"
]
=
"search_query_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
keyword
if
QueryWordAttr
.
get_search_query_results_num
(
keyword
):
is_online
=
False
if
instance
.
is_delete
else
True
...
...
trans2es/utils/tag_transfer.py
View file @
9741f3b4
...
...
@@ -169,7 +169,8 @@ class TagTransfer(object):
item_dict
=
dict
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
))
if
not
cut_bool
and
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"tag_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -272,7 +273,8 @@ class TagTransferV1(object):
item_dict
=
dict
()
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
name
),
type_v1
=
True
)
if
not
cut_bool
and
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
name
))
# item_dict["id"] = getMd5Digest(str(instance.name))
item_dict
[
"id"
]
=
"tag_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
name
item_dict
[
"is_online"
]
=
instance
.
is_online
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
name
)
...
...
@@ -282,6 +284,7 @@ class TagTransferV1(object):
item_dict
[
"tips_name_type"
]
=
0
ret_list
.
append
(
item_dict
)
suggest_list
=
get_tips_suggest_list_v1
(
str
(
instance
.
name
)
.
lower
())
logging
.
info
(
"item_dict:
%
s, suggest_list:
%
s"
%
(
item_dict
,
suggest_list
))
return
(
item_dict
,
suggest_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
trans2es/utils/wordresemble.py
View file @
9741f3b4
...
...
@@ -53,7 +53,8 @@ class WordResemble(object):
cut_bool
=
True
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
keyword
))
if
not
cut_bool
and
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
keyword
))
# item_dict["id"] = getMd5Digest(str(instance.keyword))
item_dict
[
"id"
]
=
"resemble_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
keyword
item_dict
[
"is_online"
]
=
True
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
keyword
)
...
...
@@ -240,7 +241,8 @@ class WordResembleV1(object):
cut_bool
=
True
ret_bol
=
QueryWordAttr
.
save_query_to_redis
(
query
=
str
(
instance
.
keyword
),
type_v1
=
True
)
if
not
cut_bool
and
ret_bol
:
item_dict
[
"id"
]
=
getMd5Digest
(
str
(
instance
.
keyword
))
# item_dict["id"] = getMd5Digest(str(instance.keyword))
item_dict
[
"id"
]
=
"resemble_"
+
str
(
instance
.
id
)
item_dict
[
"ori_name"
]
=
instance
.
keyword
item_dict
[
"is_online"
]
=
True
item_dict
[
"order_weight"
]
=
QueryWordAttr
.
get_project_query_word_weight
(
instance
.
keyword
)
...
...
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