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
a1bcd0ae
Commit
a1bcd0ae
authored
Aug 27, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6ea69c52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
auto_tips.py
search/utils/auto_tips.py
+7
-3
productwiki_transfer.py
trans2es/utils/productwiki_transfer.py
+4
-5
No files found.
search/utils/auto_tips.py
View file @
a1bcd0ae
...
...
@@ -163,6 +163,7 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
ret_list
.
extend
(
get_tag_wiki_data
)
ret_list
.
extend
(
get_doctor_hospital_data
)
logging
.
info
(
"get have_read_tips_set:
%
s"
%
have_read_tips_set
)
if
len
(
result_dict
[
"suggest"
][
"tips-suggest"
])
>=
50
:
return
ret_list
...
...
@@ -172,7 +173,6 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
value_data
=
[]
QUERY_KEY
=
"query:search_tip"
query_base64
=
base64
.
b64encode
(
query
.
encode
(
'utf8'
))
.
decode
(
'utf8'
)
logging
.
info
(
"get query_base64:
%
s"
%
query_base64
)
if
redis_client
.
hget
(
QUERY_KEY
,
query_base64
)
is
not
None
:
value_data
=
json
.
loads
(
redis_client
.
hget
(
QUERY_KEY
,
query_base64
))
logging
.
info
(
"get value_data:
%
s"
%
value_data
)
...
...
@@ -184,6 +184,8 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
if
ori_name
not
in
have_read_tips_set
:
have_read_tips_set
.
add
(
ori_name
)
result_num
=
i
.
get
(
key
,
0
)
describe
=
"约"
+
str
(
result_num
)
+
"个结果"
if
result_num
else
""
logging
.
info
(
"get result_num:
%
s"
%
result_num
)
highlight_marks
=
u'<ems>
%
s</ems>'
%
query
highlight_name
=
ori_name
.
replace
(
query
,
highlight_marks
)
if
ori_name
==
query
:
...
...
@@ -191,13 +193,15 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
{
"results_num"
:
result_num
,
"ori_name"
:
ori_name
,
"id"
:
None
,
"is_online"
:
True
,
"offline_score"
:
0
,
"type_flag"
:
get_tips_word_type
(
ori_name
),
"highlight_name"
:
highlight_name
,
"describe"
:
""
})
"describe"
:
describe
})
else
:
wordresemble_ret_list
.
append
(
{
"results_num"
:
result_num
,
"ori_name"
:
ori_name
,
"id"
:
None
,
"is_online"
:
True
,
"offline_score"
:
0
,
"type_flag"
:
get_tips_word_type
(
ori_name
),
"highlight_name"
:
highlight_name
,
"describe"
:
""
})
"describe"
:
describe
})
logging
.
info
(
"get query_ret_list:
%
s"
%
query_ret_list
)
logging
.
info
(
"get wordresemble_ret_list:
%
s"
%
wordresemble_ret_list
)
ret_list
.
extend
(
query_ret_list
)
ret_list
.
extend
(
wordresemble_ret_list
)
if
len
(
ret_list
)
>=
50
:
...
...
trans2es/utils/productwiki_transfer.py
View file @
a1bcd0ae
...
...
@@ -4,13 +4,13 @@ import os
import
sys
import
logging
import
traceback
from
libs.tools
import
tzlc
,
getMd5Digest
from
libs.tools
import
tzlc
,
getMd5Digest
from
libs.es
import
ESPerform
from
libs.cache
import
redis_client
import
json
from
trans2es.commons.commons
import
get_tips_suggest_list
from
trans2es.commons.words_utils
import
QueryWordAttr
,
get_tips_word_type
from
trans2es.commons.words_utils
import
QueryWordAttr
,
get_tips_word_type
class
ProduceWikiTransfer
(
object
):
...
...
@@ -35,7 +35,7 @@ class ProduceWikiTransfer(object):
suggest_list
=
get_tips_suggest_list
(
instance
.
name
)
return
(
item_dict
,
suggest_list
)
return
(
item_dict
,
suggest_list
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
([],[])
\ No newline at end of file
return
([],
[])
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