Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
钟尚武
physical
Commits
0d7ef5e2
Commit
0d7ef5e2
authored
May 31, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotword' into test
parents
a19efb8b
8c600a7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
group.py
search/views/group.py
+1
-1
search_hotword.py
search/views/search_hotword.py
+22
-2
No files found.
search/views/group.py
View file @
0d7ef5e2
...
...
@@ -279,7 +279,7 @@ def search_physical(query="", offset=0, size=10):
result_dicts
=
GroupUtils
.
get_search_pictorial_topic
(
query
,
offset
,
size
)
group_ids_list
=
[]
if
len
(
result_dicts
[
"hits"
])
>
0
:
group_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
[
"hits"
]]
group_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
s
[
"hits"
]]
return
{
"search_topic_ids"
:
group_ids_list
}
except
:
...
...
search/views/search_hotword.py
View file @
0d7ef5e2
...
...
@@ -33,9 +33,29 @@ def search_hotword(device_id=-1):
try
:
all_tag_name_list
=
set
()
# 获取搜索推荐热词
results_registr_tag
=
RegisterShowTag
.
objects
.
filter
(
is_deleted
=
False
,
is_online
=
1
)
.
count
()
results_tag
=
Tag
.
objects
.
filter
(
is_online
=
True
,
collection
=
1
)
.
count
()
# 获取符合条件的核心词
q
=
{}
q
[
"query"
]
=
{
"bool"
:
{
"must"
:
[
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"collection"
:
1
}
}
]
}
}
es_cli_obj
=
ESPerform
.
get_cli
()
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"tag"
,
q
,
offset
,
size
)
results_tag
=
result_dict
[
"hits"
][
"total"
]
logging
.
info
(
"get totoal:
%
s"
%
results_tag
)
# results_tag = Tag.objects.filter(is_online=True, collection=1).count()
tag_id
=
random
.
sample
(
range
(
1
,
results_registr_tag
),
1
)
results_tag_chose
=
Tag
.
objects
.
filter
(
id__in
=
tag_id
)
.
values_list
(
"name"
,
flat
=
True
)
for
i
in
results_tag_chose
:
...
...
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