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
597ee7a2
Commit
597ee7a2
authored
Aug 23, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
367c9627
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
develop_server.py
develop_server.py
+31
-0
auto_tips.py
search/utils/auto_tips.py
+2
-1
No files found.
develop_server.py
0 → 100644
View file @
597ee7a2
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 @
597ee7a2
...
@@ -172,8 +172,10 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
...
@@ -172,8 +172,10 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
value_data
=
[]
value_data
=
[]
QUERY_KEY
=
"query:search_tip"
QUERY_KEY
=
"query:search_tip"
query_base64
=
base64
.
b64encode
(
query
.
encode
(
'utf8'
))
.
decode
(
'utf8'
)
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
:
if
redis_client
.
hget
(
QUERY_KEY
,
query_base64
)
is
not
None
:
value_data
=
json
.
loads
(
redis_client
.
hget
(
QUERY_KEY
,
query_base64
))
value_data
=
json
.
loads
(
redis_client
.
hget
(
QUERY_KEY
,
query_base64
))
logging
.
info
(
"get value_data:
%
s"
%
value_data
)
if
len
(
value_data
)
>
0
:
if
len
(
value_data
)
>
0
:
for
i
in
value_data
:
for
i
in
value_data
:
...
@@ -200,7 +202,6 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
...
@@ -200,7 +202,6 @@ def get_suggest_tips(query, lat, lng, offset=0, size=50):
ret_list
.
extend
(
wordresemble_ret_list
)
ret_list
.
extend
(
wordresemble_ret_list
)
if
len
(
ret_list
)
>=
50
:
if
len
(
ret_list
)
>=
50
:
return
ret_list
[
0
:
50
]
return
ret_list
[
0
:
50
]
else
:
else
:
return
ret_list
return
ret_list
...
...
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