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
a5f745d0
Commit
a5f745d0
authored
Jan 18, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete search/views
parent
04e64992
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
71 deletions
+0
-71
__init__.py
search/views/__init__.py
+0
-0
auto_tips.py
search/views/auto_tips.py
+0
-71
No files found.
search/views/__init__.py
deleted
100644 → 0
View file @
04e64992
search/views/auto_tips.py
deleted
100644 → 0
View file @
04e64992
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
,
absolute_import
,
print_function
from
gm_rpcd.all
import
bind
import
logging
import
traceback
import
json
from
libs.es
import
ESPerform
from
libs.cache
import
redis_client
from
libs.tools
import
json_http_response
from
search.utils.auto_tips
import
get_suggest_tips
def
auto_complete
(
request
):
try
:
"""auto complate words/tags/doctors etc.
URL:
~/api/auto_complete?scope=[kw]&q=双
Return:
{'error': 0|1, 'data': [word, word, word],}
"""
q
=
request
.
GET
.
get
(
'q'
,
''
)
.
strip
()
if
not
q
:
return
json_http_response
({
'error'
:
0
,
'data'
:
[]})
data
=
get_suggest_tips
(
q
)
result
=
{
'error'
:
0
,
'data'
:
data
,
}
return
json_http_response
(
result
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
json_http_response
({
'error'
:
1
,
'data'
:
[]})
@bind
(
"search_tips/search/auto_complete_query"
)
def
auto_complete_query
(
q
):
try
:
"""auto complate words/tags/doctors etc.
URL:
~/api/auto_complete?scope=[kw]&q=双
Return:
{'error': 0|1, 'data': [word, word, word],}
"""
# q = request.GET.get('q', '').strip()
# if not q:
# return json_http_response({'error': 0, 'data': []})
data
=
get_suggest_tips
(
q
)
result
=
{
'error'
:
0
,
'data'
:
data
,
}
return
{
"data"
:
data
}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"data"
:[]}
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