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
ac5effe0
Commit
ac5effe0
authored
6 years ago
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
7d405ea6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
tasks.py
injection/data_sync/tasks.py
+1
-1
pick.py
search/utils/pick.py
+5
-2
topic.py
search/utils/topic.py
+4
-4
pick.py
search/views/pick.py
+1
-1
No files found.
injection/data_sync/tasks.py
View file @
ac5effe0
...
@@ -36,7 +36,7 @@ def sync_face_similar_data_to_redis():
...
@@ -36,7 +36,7 @@ def sync_face_similar_data_to_redis():
result_items
=
FaceUserContrastSimilar
.
objects
.
filter
(
is_online
=
True
,
is_deleted
=
False
)
.
distinct
()
.
values
(
"participant_user_id"
)
.
values_list
(
"participant_user_id"
,
flat
=
True
)
result_items
=
FaceUserContrastSimilar
.
objects
.
filter
(
is_online
=
True
,
is_deleted
=
False
)
.
distinct
()
.
values
(
"participant_user_id"
)
.
values_list
(
"participant_user_id"
,
flat
=
True
)
logging
.
info
(
"duan add,begin sync_face_similar_data_to_redis!"
)
logging
.
info
(
"duan add,begin sync_face_similar_data_to_redis!"
)
redis_key_prefix
=
"physical:user_similar:participant_user_id:"
redis_key_prefix
=
"physical:user_similar:participant_user_id:"
for
participant_user_id
in
result_items
:
for
participant_user_id
in
result_items
:
...
...
This diff is collapsed.
Click to expand it.
search/utils/pick.py
View file @
ac5effe0
...
@@ -11,7 +11,7 @@ from libs.cache import redis_client
...
@@ -11,7 +11,7 @@ from libs.cache import redis_client
class
PickUtils
(
object
):
class
PickUtils
(
object
):
@classmethod
@classmethod
def
refresh_redis_data
(
cls
,
have_read_celebrity_list
,
redis_cli
,
redis_key
):
def
refresh_redis_data
(
cls
,
have_read_celebrity_list
,
redis_cli
,
redis_key
,
if_expire
=
True
):
try
:
try
:
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
datetime
.
now
()
...
@@ -20,7 +20,10 @@ class PickUtils(object):
...
@@ -20,7 +20,10 @@ class PickUtils(object):
valid_seconds
=
int
((
end_time
-
now
)
.
seconds
)
valid_seconds
=
int
((
end_time
-
now
)
.
seconds
)
redis_cli
.
setex
(
redis_key
,
valid_seconds
,
json
.
dumps
(
have_read_celebrity_list
))
if
if_expire
:
redis_cli
.
setex
(
redis_key
,
valid_seconds
,
json
.
dumps
(
have_read_celebrity_list
))
else
:
redis_cli
.
set
(
redis_key
,
json
.
dumps
(
have_read_celebrity_list
))
return
True
return
True
except
:
except
:
...
...
This diff is collapsed.
Click to expand it.
search/utils/topic.py
View file @
ac5effe0
...
@@ -175,15 +175,15 @@ class TopicUtils(object):
...
@@ -175,15 +175,15 @@ class TopicUtils(object):
}
}
}
}
},
},
"score_mode"
:
"
sum
"
,
"score_mode"
:
"
max
"
,
"boost_mode"
:
"
sum
"
,
"boost_mode"
:
"
replace
"
,
"functions"
:
functions_list
"functions"
:
functions_list
}
}
if
query
is
not
None
:
#搜索帖子
if
query
is
not
None
:
#搜索帖子
multi_fields
=
{
multi_fields
=
{
'description'
:
2
,
'description'
:
2
00
,
'name'
:
4
,
'name'
:
4
00
,
}
}
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
multi_match
=
{
multi_match
=
{
...
...
This diff is collapsed.
Click to expand it.
search/views/pick.py
View file @
ac5effe0
...
@@ -116,7 +116,7 @@ def pick_topic(user_id,pick_id,offset=0,size=10):
...
@@ -116,7 +116,7 @@ def pick_topic(user_id,pick_id,offset=0,size=10):
if
len
(
recommend_pick_topic_list
)
>
0
and
user_id
!=-
1
:
if
len
(
recommend_pick_topic_list
)
>
0
and
user_id
!=-
1
:
total_read_topic_ids
=
have_read_pick_topic_ids
+
recommend_pick_topic_list
total_read_topic_ids
=
have_read_pick_topic_ids
+
recommend_pick_topic_list
PickUtils
.
refresh_redis_data
(
have_read_celebrity_list
=
total_read_topic_ids
,
PickUtils
.
refresh_redis_data
(
have_read_celebrity_list
=
total_read_topic_ids
,
redis_cli
=
redis_client
,
redis_key
=
redis_key
)
redis_cli
=
redis_client
,
redis_key
=
redis_key
,
if_expire
=
False
)
return
{
"recommend_pick_topic_ids"
:
recommend_pick_topic_list
}
return
{
"recommend_pick_topic_ids"
:
recommend_pick_topic_list
}
...
...
This diff is collapsed.
Click to expand it.
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