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
a04caf2e
Commit
a04caf2e
authored
Jun 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改结果
parent
c11344ba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
6 deletions
+39
-6
develop_server.py
develop_server.py
+31
-0
auto_tips.py
search/utils/auto_tips.py
+3
-1
type_info.py
trans2es/type_info.py
+4
-4
wordresemble.py
trans2es/utils/wordresemble.py
+1
-1
No files found.
develop_server.py
0 → 100644
View file @
a04caf2e
import
sys
from
gm_rpcd.commands.utils
import
add_cwd_to_path
from
gm_rpcd.internals.utils
import
serve
def
main
(
args
):
add_cwd_to_path
()
from
gm_rpcd.internals.configuration
import
config
config
.
is_develop_mode
=
True
config
.
freeze
()
host
=
'127.0.0.1'
port
=
9000
try
:
first_arg
=
args
[
0
]
except
IndexError
:
pass
else
:
if
':'
in
first_arg
:
host
,
port
=
first_arg
.
split
(
':'
)
port
=
int
(
port
)
else
:
port
=
int
(
first_arg
)
print
(
'Serving on {}:{}'
.
format
(
host
,
port
))
serve
(
host
=
host
,
port
=
port
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
:])
search/utils/auto_tips.py
View file @
a04caf2e
...
...
@@ -96,10 +96,12 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
ori_name
=
base64
.
b64decode
(
ori
.
encode
(
'utf8'
))
.
decode
(
'utf8'
)
if
ori_name
not
in
have_read_tips_set
:
result_num
=
i
.
split
(
":"
)[
1
]
highlight_marks
=
u'<ems>
%
s</ems>'
%
query
highlight_name
=
hit_item
[
"_source"
][
"ori_name"
]
.
replace
(
query
,
highlight_marks
)
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"
:
ori
_name
,
"describe"
:
""
})
"type_flag"
:
get_tips_word_type
(
ori_name
),
"highlight_name"
:
highlight
_name
,
"describe"
:
""
})
if
len
(
ret_list
)
>=
50
:
return
ret_list
[
0
:
50
]
...
...
trans2es/type_info.py
View file @
a04caf2e
...
...
@@ -530,9 +530,9 @@ def tips_attr_sync_to_redis_type_info_map():
TypeInfo
(
name
=
'suggest'
,
type
=
'wordrel_results_num'
,
# api_wordrelresemble
model
=
doctor
.
Hospita
l
,
model
=
wordresemble
.
WordRe
l
,
query_deferred
=
lambda
:
wordresemble
.
WordRel
.
objects
.
filter
(
category__in
=
[
0
,
1
,
2
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
])
.
query
,
category__in
=
[
13
,
12
,
11
,
9
,
1
])
.
query
,
get_data_func
=
WordResemble
.
get_all_data_name_mapping_results_to_redis
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
...
...
@@ -541,9 +541,9 @@ def tips_attr_sync_to_redis_type_info_map():
TypeInfo
(
name
=
'suggest'
,
type
=
'wordresemble_results_num'
,
# api_wordrelresemble
model
=
doctor
.
Hospita
l
,
model
=
wordresemble
.
WordRe
l
,
query_deferred
=
lambda
:
wordresemble
.
WordRel
.
objects
.
filter
(
category__in
=
[
0
,
1
,
2
,
9
,
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
])
.
query
,
category__in
=
[
13
,
12
,
11
,
9
,
1
])
.
query
,
get_data_func
=
WordResemble
.
set_data_to_redis
,
bulk_insert_chunk_size
=
100
,
round_insert_chunk_size
=
5
,
...
...
trans2es/utils/wordresemble.py
View file @
a04caf2e
...
...
@@ -152,7 +152,7 @@ class WordResemble(object):
@classmethod
def
set_data_to_redis
(
cls
,
instance
):
try
:
WordResemble
.
get_all_data_name_mapping_results_to_redis
(
instance
)
QUERY_KEY
=
"query:{}:search_tip"
tips_num_redis_key_prefix
=
"search_tips:tips_mapping_num"
...
...
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