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
5fe061e4
Commit
5fe061e4
authored
Jul 16, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
932c71ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
2 deletions
+66
-2
auto_tips.py
associate/search/utils/auto_tips.py
+35
-2
develop_server.py
develop_server.py
+31
-0
No files found.
associate/search/utils/auto_tips.py
View file @
5fe061e4
...
...
@@ -27,6 +27,40 @@ def get_suggest_tips(query, agile_tag_type=-1):
index_name
=
'associate_tag'
query
=
query
.
replace
(
"
\u2006
"
,
''
)
qq
=
{
"query"
:
{
"bool"
:
{
"must"
:
{
"term"
:
{
"ori_name"
:
query
}
}
}
}
}
logging
.
info
(
"get qqqqqqqqq:
%
s"
%
qq
)
whole_query
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_name
,
query_body
=
qq
,
offset
=
0
,
size
=
1
,
is_suggest_request
=
True
)
logging
.
info
(
"get whole_query:
%
s"
%
whole_query
)
have_read_tips_set
=
set
()
ret_list
=
list
()
hits
=
whole_query
[
"hits"
][
"hits"
]
for
item
in
hits
:
have_read_tips_set
.
add
(
item
[
"_source"
][
"ori_name"
])
agile_tag_id
=
item
[
"_source"
][
"agile_tag_id"
]
ori_name
=
item
[
"_source"
][
"ori_name"
]
results_num
=
item
[
"_source"
][
"results_num"
]
highlight_marks
=
u'<ems>
%
s</ems>'
%
query
item
[
"_source"
][
"highlight_name"
]
=
item
[
"_source"
][
"ori_name"
]
.
replace
(
query
,
highlight_marks
)
highlight_name
=
item
[
"_source"
][
"highlight_name"
]
ret_list
.
append
({
"agile_tag_id"
:
agile_tag_id
,
"ori_name"
:
ori_name
,
"results_num"
:
results_num
,
"highlight"
:
highlight_name
})
q
=
{
"suggest"
:
{
"tips-suggest"
:
{
...
...
@@ -44,8 +78,7 @@ def get_suggest_tips(query, agile_tag_type=-1):
}
}
}
have_read_tips_set
=
set
()
ret_list
=
list
()
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_name
,
query_body
=
q
,
offset
=
0
,
size
=
50
,
is_suggest_request
=
True
)
...
...
develop_server.py
0 → 100644
View file @
5fe061e4
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
:])
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