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
1fc8d9b7
Commit
1fc8d9b7
authored
Dec 08, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
e37df867
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
topic.py
search/utils/topic.py
+15
-6
user.json
trans2es/mapping/user.json
+4
-4
user.py
trans2es/models/user.py
+2
-2
No files found.
search/utils/topic.py
View file @
1fc8d9b7
...
@@ -109,23 +109,32 @@ class TopicUtils(object):
...
@@ -109,23 +109,32 @@ class TopicUtils(object):
logging
.
warning
(
"not find user_id:
%
d in es!"
%
int
(
user_id
))
logging
.
warning
(
"not find user_id:
%
d in es!"
%
int
(
user_id
))
else
:
else
:
attention_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"attention_user_id_list"
]
attention_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"attention_user_id_list"
]
attention_user_id_list
=
[
item
[
"user_id"
]
for
item
in
attention_user_info_list
]
"""
(attention_chinese_user_id_list, attention_japan_user_id_list,
(attention_chinese_user_id_list, attention_japan_user_id_list,
attention_korea_user_id_list) = TopicUtils.analyze_related_user_id_list(
attention_korea_user_id_list) = TopicUtils.analyze_related_user_id_list(
related_user_id_list
=
attention_user_info_list
)
related_user_id_list=attention_user_info_list)
"""
pick_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"pick_user_id_list"
]
pick_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"pick_user_id_list"
]
pick_user_id_list
=
[
item
[
"user_id"
]
for
item
in
pick_user_info_list
]
"""
(pick_chinese_user_id_list, pick_japan_user_id_list,
(pick_chinese_user_id_list, pick_japan_user_id_list,
pick_korea_user_id_list
)
=
TopicUtils
.
analyze_related_user_id_list
(
pick_user_info_list
)
pick_korea_user_id_list) = TopicUtils.analyze_related_user_id_list(pick_user_info_list)
"""
same_group_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"same_group_user_id_list"
]
same_group_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"same_group_user_id_list"
]
same_group_id_list
=
[
item
[
"user_id"
]
for
item
in
same_group_user_info_list
]
"""
(same_group_chinese_user_id_list, same_group_japan_user_id_list,
(same_group_chinese_user_id_list, same_group_japan_user_id_list,
same_group_korea_user_id_list
)
=
TopicUtils
.
analyze_related_user_id_list
(
same_group_user_info_list
)
same_group_korea_user_id_list) = TopicUtils.analyze_related_user_id_list(same_group_user_info_list)
"""
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
,
field_name
=
"user_id"
)
attention_user_id_term_list
=
cls
.
___get_should_term_list
(
attention_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
,
field_name
=
"user_id"
)
pick_user_id_term_list
=
cls
.
___get_should_term_list
(
pick_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
,
field_name
=
"user_id"
)
same_group_user_id_term_list
=
cls
.
___get_should_term_list
(
same_group_id_list
,
field_name
=
"user_id"
)
q
=
dict
()
q
=
dict
()
q
[
"query"
]
=
dict
()
q
[
"query"
]
=
dict
()
...
...
trans2es/mapping/user.json
View file @
1fc8d9b7
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
"is_deleted"
:{
"type"
:
"boolean"
},
"is_deleted"
:{
"type"
:
"boolean"
},
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"city_id"
:{
"type"
:
"text"
},
"city_id"
:{
"type"
:
"text"
},
"country_id"
:{
"type"
:
"
long
"
},
"country_id"
:{
"type"
:
"
text
"
},
"is_recommend"
:{
"type"
:
"boolean"
},
//是否运营推荐用户
"is_recommend"
:{
"type"
:
"boolean"
},
//是否运营推荐用户
"is_shadow"
:{
"type"
:
"boolean"
},
//是否马甲用户
"is_shadow"
:{
"type"
:
"boolean"
},
//是否马甲用户
"latest_topic_time_val"
:{
"type"
:
"long"
},
//最近发帖时间
"latest_topic_time_val"
:{
"type"
:
"long"
},
//最近发帖时间
...
@@ -18,21 +18,21 @@
...
@@ -18,21 +18,21 @@
"type"
:
"nested"
,
"type"
:
"nested"
,
"properties"
:{
"properties"
:{
"user_id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"country_id"
:{
"type"
:
"
long
"
}
"country_id"
:{
"type"
:
"
text
"
}
}
}
},
},
"pick_user_id_list"
:{
//pick用户列表
"pick_user_id_list"
:{
//pick用户列表
"type"
:
"nested"
,
"type"
:
"nested"
,
"properties"
:{
"properties"
:{
"user_id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"country_id"
:{
"type"
:
"
long
"
}
"country_id"
:{
"type"
:
"
text
"
}
}
}
},
},
"same_group_user_id_list"
:{
//同组用户列表
"same_group_user_id_list"
:{
//同组用户列表
"type"
:
"nested"
,
"type"
:
"nested"
,
"properties"
:{
"properties"
:{
"user_id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"country_id"
:{
"type"
:
"
long
"
}
"country_id"
:{
"type"
:
"
text
"
}
}
}
},
},
"attention_group_id_list"
:{
//关注小组列表
"attention_group_id_list"
:{
//关注小组列表
...
...
trans2es/models/user.py
View file @
1fc8d9b7
...
@@ -27,8 +27,8 @@ class User(models.Model):
...
@@ -27,8 +27,8 @@ class User(models.Model):
nick_name
=
models
.
CharField
(
verbose_name
=
u'昵称'
,
max_length
=
255
,
default
=
''
)
nick_name
=
models
.
CharField
(
verbose_name
=
u'昵称'
,
max_length
=
255
,
default
=
''
)
profile_pic
=
models
.
CharField
(
verbose_name
=
u'头像'
,
max_length
=
300
)
profile_pic
=
models
.
CharField
(
verbose_name
=
u'头像'
,
max_length
=
300
)
gender
=
models
.
SmallIntegerField
(
verbose_name
=
u'性别'
)
gender
=
models
.
SmallIntegerField
(
verbose_name
=
u'性别'
)
city_id
=
models
.
CharField
(
verbose_name
=
u'城市id'
,
max_length
=
4
0
)
city_id
=
models
.
CharField
(
verbose_name
=
u'城市id'
,
max_length
=
6
0
)
country_id
=
models
.
IntegerField
(
verbose_name
=
'国家id'
)
country_id
=
models
.
CharField
(
verbose_name
=
'国家id'
,
max_length
=
40
)
is_online
=
models
.
BooleanField
(
verbose_name
=
"是否上线"
)
is_online
=
models
.
BooleanField
(
verbose_name
=
"是否上线"
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
is_deleted
=
models
.
BooleanField
(
verbose_name
=
'是否删除'
)
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
create_time
=
models
.
DateTimeField
(
verbose_name
=
u'创建时间'
,
default
=
datetime
.
datetime
.
fromtimestamp
(
0
))
...
...
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