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
alpha
physical
Commits
579a42a9
Commit
579a42a9
authored
May 31, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改获取数据的大
parent
eea2f48e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
tasks.py
injection/data_sync/tasks.py
+6
-7
search_hotword.py
search/views/search_hotword.py
+5
-2
No files found.
injection/data_sync/tasks.py
View file @
579a42a9
...
...
@@ -63,17 +63,17 @@ def sync_face_similar_data_to_redis():
weight_score
=
int
(
item
.
similarity
*
100
)
item_list
.
append
(
{
"filter"
:{
"constant_score"
:{
"filter"
:{
"term"
:{
"user_id"
:
item
.
contrast_user_id
}
"filter"
:
{
"constant_score"
:
{
"filter"
:
{
"term"
:
{
"user_id"
:
item
.
contrast_user_id
}
}
}
},
"weight"
:
weight_score
*
2
"weight"
:
weight_score
*
2
}
)
if
len
(
item_list
)
>=
100
:
if
len
(
item_list
)
>=
100
:
break
redis_client
.
set
(
redis_key
,
json
.
dumps
(
item_list
))
...
...
@@ -106,4 +106,3 @@ def sync_user_similar_score():
redis_client
.
set
(
redis_key
,
json
.
dumps
(
item_list
))
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
search/views/search_hotword.py
View file @
579a42a9
...
...
@@ -33,10 +33,13 @@ 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_registr_tag = RegisterShowTag.objects.filter(is_deleted=False, is_online=1).count()
# 获取符合条件的核心词
results_tag
=
Tag
.
objects
.
filter
(
is_online
=
True
,
collection
=
1
)
.
count
()
# results_tag = Tag.objects.filter(is_online=True, collection=1).count()
results_registr_tag
=
25
results_tag
=
10189849
tag_id
=
random
.
sample
(
range
(
1
,
results_registr_tag
),
6
)
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