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
efc03161
Commit
efc03161
authored
Jun 21, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Plain Diff
add
parents
1907bb51
91465585
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
128 additions
and
20 deletions
+128
-20
Project.xml
.idea/codeStyles/Project.xml
+25
-0
develop_server.py
develop_server.py
+31
-0
tasks.py
injection/data_sync/tasks.py
+2
-4
group.py
search/utils/group.py
+10
-7
topic.py
search/utils/topic.py
+1
-1
group.py
search/views/group.py
+37
-2
search_hotword.py
search/views/search_hotword.py
+4
-0
user.py
search/views/user.py
+1
-1
topic-star.json
trans2es/mapping/topic-star.json
+1
-1
topic.json
trans2es/mapping/topic.json
+9
-1
user.json
trans2es/mapping/user.json
+3
-3
topic.py
trans2es/models/topic.py
+0
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+3
-0
user_transfer.py
trans2es/utils/user_transfer.py
+1
-0
No files found.
.idea/codeStyles/Project.xml
View file @
efc03161
...
...
@@ -24,5 +24,29 @@
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"false"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
</code_scheme>
</component>
\ No newline at end of file
develop_server.py
0 → 100644
View file @
efc03161
import
sys
from
gm_rpcd.commands.utils
import
add_cwd_to_path
from
gm_rpcd.internals.utils
import
serve
def
main
(
args
):
add_cwd_to_path
()
from
gm_rpcd.internals.configuration
import
config
config
.
is_develop_mode
=
True
config
.
freeze
()
host
=
'127.0.0.1'
port
=
9000
try
:
first_arg
=
args
[
0
]
except
IndexError
:
pass
else
:
if
':'
in
first_arg
:
host
,
port
=
first_arg
.
split
(
':'
)
port
=
int
(
port
)
else
:
port
=
int
(
first_arg
)
print
(
'Serving on {}:{}'
.
format
(
host
,
port
))
serve
(
host
=
host
,
port
=
port
)
if
__name__
==
'__main__'
:
main
(
sys
.
argv
[
1
:])
injection/data_sync/tasks.py
View file @
efc03161
...
...
@@ -113,12 +113,10 @@ def sync_user_similar_score():
def
get_tag_count
():
try
:
# 获取搜索推荐热词
results_registr_tag
=
list
(
set
(
RegisterShowTag
.
objects
.
filter
(
is_deleted
=
False
,
is_online
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
)))
results_registr_tag
=
list
(
set
(
RegisterShowTag
.
objects
.
filter
(
is_deleted
=
False
,
is_online
=
1
)
.
values_list
(
"tag_id"
,
flat
=
True
)))
# 获取符合条件的核心词
results_tag
=
list
(
set
(
Tag
.
objects
.
filter
(
is_online
=
True
,
is_deleted
=
False
,
collection
=
1
)
.
values_list
(
"id"
,
flat
=
True
)))
results_tag
=
list
(
set
(
Tag
.
objects
.
filter
(
is_online
=
True
,
is_deleted
=
False
,
collection
=
1
)
.
values_list
(
"id"
,
flat
=
True
)))
redis_registr_tag
=
"physical:search_hotword:results_registr_tag"
redis_tag
=
"physical:search_hotword:results_tag"
...
...
search/utils/group.py
View file @
efc03161
...
...
@@ -238,14 +238,19 @@ class GroupUtils(object):
{
"term"
:
{
"is_deleted"
:
False
}},
{
"term"
:
{
"is_default"
:
0
}},
{
"range"
:
{
"topic_id_list"
:
{
"gte"
:
0
}}},
{
"term"
:
{
"is_cover"
:
True
}},
{
"term"
:
{
"is_cover"
:
True
}}
],
"should"
:
[
{
'multi_match'
:
multi_match
}
]
],
"minimum_should_match"
:
1
}
}
q
[
"_source"
]
=
{
"includes"
:
[
"id"
,
"is_online"
,
"is_deleted"
,
"is_default"
,
"name"
,
"description"
,
"tag_name"
,
"is_cover"
,
"offline_score"
,
"is_default"
]
"includes"
:
[
"id"
,
"is_online"
,
"is_deleted"
,
"is_default"
,
"name"
,
"tag_name"
,
"description"
,
"is_cover"
,
"offline_score"
,
"is_default"
]
}
q
[
"sort"
]
=
[
{
...
...
@@ -265,11 +270,9 @@ class GroupUtils(object):
}
]
logging
.
info
(
"get get_search_pictorial_topic:
%
s"
%
q
)
es_cli_obj
=
ESPerform
.
get_cli
()
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"pictorial"
,
q
,
offset
,
size
)
logging
.
info
(
"get qqqqqq:
%
s"
%
q
)
logging
.
info
(
"get result_dict:
%
s"
%
result_dict
)
return
result_dict
except
:
...
...
search/utils/topic.py
View file @
efc03161
...
...
@@ -260,7 +260,7 @@ class TopicUtils(object):
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
multi_match
=
{
'query'
:
query
,
'type'
:
'
cross
_fields'
,
'type'
:
'
best
_fields'
,
'operator'
:
'and'
,
'fields'
:
query_fields
,
}
...
...
search/views/group.py
View file @
efc03161
...
...
@@ -104,8 +104,26 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
q
=
{}
# 获取帖子从属的画报
q
[
"query"
]
=
{
"term"
:
{
"id"
:
topic_id
"bool"
:
{
"must"
:
[
{
"term"
:
{
"id"
:
topic_id
}
},
{
"term"
:
{
"is_online"
:
True
}
}
],
"must_not"
:
[
{
"term"
:
{
"is_history"
:
True
}
}
]
}
}
q
[
"_source"
]
=
{
...
...
@@ -218,6 +236,7 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
def
pictorial_topic_sort
(
pictorial_id
=-
1
,
offset
=
0
,
size
=
10
):
"""
:remark 画报排序 人气 部分
人气按照票数从大到小排序,相同票数按照图片票数更新时间由旧到新排序
:param user_id:
:param sort_type:
:param offset:
...
...
@@ -235,6 +254,22 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
{
"term"
:
{
"pictorial_id"
:
pictorial_id
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}},
# {
# "nested": {
# "path": "related_billboard",
# "query": {
# "bool": {
# "must": [
# {
# "term": {
# "pictorial_id": pictorial_id
# }
# }
# ]
# }
# }
# }
# }
]
}
},
...
...
search/views/search_hotword.py
View file @
efc03161
...
...
@@ -51,6 +51,7 @@ def search_hotword(device_id=-1):
if
len
(
all_tag_name_list
)
==
6
or
num
==
results_tag
:
break
logging
.
info
(
"get all_tag_name_list:
%
s"
%
all_tag_name_list
)
# 获取个性化标签
linucb_recommend_redis_prefix
=
"physical:linucb:tag_recommend:device_id:"
tag_recommend_redis_key
=
linucb_recommend_redis_prefix
+
str
(
device_id
)
...
...
@@ -61,6 +62,7 @@ def search_hotword(device_id=-1):
set
(
Tag
.
objects
.
filter
(
id
=
item
,
is_online
=
True
)
.
values_list
(
"name"
,
flat
=
True
)))
if
results_tag_recommend
:
all_tag_name_list
.
add
(
results_tag_recommend
[
0
])
logging
.
info
(
"get all_tag_name_list:
%
s"
%
all_tag_name_list
)
if
len
(
all_tag_name_list
)
==
12
:
return
{
"recommend_tag_name"
:
list
(
all_tag_name_list
)}
...
...
@@ -74,6 +76,8 @@ def search_hotword(device_id=-1):
if
results_tag_hexin
:
if
results_tag_hexin
[
0
]
not
in
all_tag_name_list
:
all_tag_name_list
.
add
(
results_tag_hexin
[
0
])
logging
.
info
(
"get all_tag_name_list:
%
s"
%
all_tag_name_list
)
if
len
(
all_tag_name_list
)
>=
12
:
return
{
"recommend_tag_name"
:
list
(
all_tag_name_list
)}
...
...
search/views/user.py
View file @
efc03161
...
...
@@ -114,7 +114,7 @@ def search_user(query="", offset=0, size=10):
"bool"
:
{
"must"
:
[
{
"term"
:
{
"nick_
name_
pre"
:
query
"nick_pre"
:
query
}
},
{
"term"
:
{
...
...
trans2es/mapping/topic-star.json
View file @
efc03161
...
...
@@ -14,7 +14,7 @@
"content_level"
:{
"type"
:
"text"
},
"user_id"
:{
"type"
:
"long"
},
"user_nick_name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
//帖子用户名
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"
index"
:
"not_analyze
d"
},
//不切词的用户名
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"
analyzer"
:
"keywor
d"
},
//不切词的用户名
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
...
...
trans2es/mapping/topic.json
View file @
efc03161
...
...
@@ -55,6 +55,14 @@
},
"is_excellent"
:{
"type"
:
"long"
},
"is_operation_home_recommend"
:
{
"type"
:
"boolean"
},
//是否首页运营推荐
"is_history"
:
{
"type"
:
"boolean"
}
//是否历史数据
"is_history"
:
{
"type"
:
"boolean"
},
//是否历史数据
,
"related_billboard"
:{
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
}
}
}
}
}
trans2es/mapping/user.json
View file @
efc03161
...
...
@@ -4,7 +4,8 @@
"id"
:{
"type"
:
"long"
},
"user_id"
:{
"type"
:
"long"
},
"nick_name"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
//昵称
"nick_name_pre"
:{
"type"
:
"text"
,
"index"
:
"not_analyzed"
},
//昵称
"nick_pre"
:{
"type"
:
"text"
,
"analyzer"
:
"keyword"
},
//昵称
"nick_name_pre"
:{
"type"
:
"text"
},
//昵称
"profile_pic"
:{
"type"
:
"text"
},
//头像
"gender"
:{
"type"
:
"integer"
},
"is_online"
:{
"type"
:
"boolean"
},
//是否上线
...
...
@@ -64,4 +65,4 @@
"update_time_val"
:{
"type"
:
"long"
},
"count_topic"
:{
"type"
:
"long"
}
}
}
\ No newline at end of file
}
trans2es/models/topic.py
View file @
efc03161
This diff is collapsed.
Click to expand it.
trans2es/utils/topic_transfer.py
View file @
efc03161
...
...
@@ -138,6 +138,9 @@ class TopicTransfer(object):
res
[
"is_operation_home_recommend"
]
=
True
logging
.
info
(
"test topic transfer time cost,time0:
%
d,time1:
%
d,time2:
%
d,time3:
%
d,time4:
%
d"
%
(
time0
,
time1
,
time2
,
time3
,
time4
))
#榜单关联的投票
res
[
"related_billboard"
]
=
instance
.
get_related_billboard
()
return
res
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
trans2es/utils/user_transfer.py
View file @
efc03161
...
...
@@ -42,6 +42,7 @@ class UserTransfer(object):
res
[
"user_id"
]
=
instance
.
user_id
res
[
"nick_name"
]
=
instance
.
nick_name
res
[
"nick_name_pre"
]
=
instance
.
nick_name
res
[
"nick_pre"
]
=
instance
.
nick_name
res
[
"profile_pic"
]
=
instance
.
profile_pic
res
[
"gender"
]
=
instance
.
gender
res
[
"city_id"
]
=
instance
.
city_id
...
...
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