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
c83aed56
Commit
c83aed56
authored
Dec 05, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
4adc2d99
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
topic.py
search/utils/topic.py
+5
-5
user.py
search/utils/user.py
+2
-0
user.py
search/views/user.py
+1
-1
No files found.
search/utils/topic.py
View file @
c83aed56
...
@@ -72,13 +72,13 @@ class TopicUtils(object):
...
@@ -72,13 +72,13 @@ class TopicUtils(object):
return
False
return
False
@classmethod
@classmethod
def
___get_should_term_list
(
cls
,
ori_list
):
def
___get_should_term_list
(
cls
,
ori_list
,
field_name
=
"tag_list"
):
try
:
try
:
should_term_list
=
list
()
should_term_list
=
list
()
for
term_id
in
ori_list
:
for
term_id
in
ori_list
:
term_dict
=
{
term_dict
=
{
"term"
:{
"term"
:{
"tag_list"
:{
"value"
:
term_id
}
field_name
:{
"value"
:
term_id
}
}
}
}
}
should_term_list
.
append
(
term_dict
)
should_term_list
.
append
(
term_dict
)
...
@@ -123,9 +123,9 @@ class TopicUtils(object):
...
@@ -123,9 +123,9 @@ class TopicUtils(object):
user_tag_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"tag_list"
]
user_tag_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"tag_list"
]
attention_user_id_term_list
=
cls
.
___get_should_term_list
(
attention_chinese_user_id_list
+
attention_japan_user_id_list
+
attention_korea_user_id_list
)
attention_user_id_term_list
=
cls
.
___get_should_term_list
(
attention_chinese_user_id_list
+
attention_japan_user_id_list
+
attention_korea_user_id_list
,
field_name
=
"user_id"
)
pick_user_id_term_list
=
cls
.
___get_should_term_list
(
pick_chinese_user_id_list
+
pick_japan_user_id_list
+
pick_korea_user_id_list
)
pick_user_id_term_list
=
cls
.
___get_should_term_list
(
pick_chinese_user_id_list
+
pick_japan_user_id_list
+
pick_korea_user_id_list
,
field_name
=
"user_id"
)
same_group_user_id_term_list
=
cls
.
___get_should_term_list
(
same_group_chinese_user_id_list
+
same_group_japan_user_id_list
+
same_group_korea_user_id_list
)
same_group_user_id_term_list
=
cls
.
___get_should_term_list
(
same_group_chinese_user_id_list
+
same_group_japan_user_id_list
+
same_group_korea_user_id_list
,
field_name
=
"user_id"
)
q
=
dict
()
q
=
dict
()
q
[
"query"
]
=
dict
()
q
[
"query"
]
=
dict
()
...
...
search/utils/user.py
View file @
c83aed56
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
import
logging
import
logging
import
traceback
import
traceback
import
json
import
json
import
time
from
libs.es
import
ESPerform
from
libs.es
import
ESPerform
...
@@ -83,6 +84,7 @@ class UserUtils(object):
...
@@ -83,6 +84,7 @@ class UserUtils(object):
{
{
"gauss"
:
{
"gauss"
:
{
"latest_topic_time_val"
:
{
"latest_topic_time_val"
:
{
"origin"
:
int
(
time
.
time
()),
"scale"
:
"600"
,
"scale"
:
"600"
,
"decay"
:
0.1
"decay"
:
0.1
}
}
...
...
search/views/user.py
View file @
c83aed56
...
@@ -15,7 +15,7 @@ from search.utils.common import *
...
@@ -15,7 +15,7 @@ from search.utils.common import *
@bind
(
"physical/search/recommend_user"
)
@bind
(
"physical/search/recommend_user"
)
def
recommend_user
(
self_user_id
,
interesting_user_id
,
offset
=
0
,
size
=
10
):
def
recommend_user
(
self_user_id
,
interesting_user_id
,
offset
=
0
,
size
=
10
):
"""
"""
:remark 点关注推荐用户
,缺少按时间排序策略
:remark 点关注推荐用户
:param self_user_id:
:param self_user_id:
:param interesting_user_id:
:param interesting_user_id:
:param offset:
:param offset:
...
...
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