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
f1c48ef6
Commit
f1c48ef6
authored
Aug 07, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'highlight_topic' of git.wanmeizhensuo.com:alpha/physical into highlight_topic
parents
bf786d54
908f59d6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
59 additions
and
25 deletions
+59
-25
misc.xml
.idea/misc.xml
+1
-1
physical.iml
.idea/physical.iml
+1
-1
tasks.py
injection/data_sync/tasks.py
+23
-0
es.py
libs/es.py
+3
-1
collect_data.py
linucb/views/collect_data.py
+0
-1
group.py
search/utils/group.py
+8
-2
topic.py
search/utils/topic.py
+4
-2
group.py
search/views/group.py
+0
-0
search_hotword.py
search/views/search_hotword.py
+1
-1
topic-high-star.json
trans2es/mapping/topic-high-star.json
+1
-0
topic-star-routing.json
trans2es/mapping/topic-star-routing.json
+8
-8
topic.json
trans2es/mapping/topic.json
+9
-8
No files found.
.idea/misc.xml
View file @
f1c48ef6
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.6 (
physical1
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.6 (
LiXiaoFang
)"
project-jdk-type=
"Python SDK"
/>
<component
name=
"PyCharmProfessionalAdvertiser"
>
<option
name=
"shown"
value=
"true"
/>
</component>
...
...
.idea/physical.iml
View file @
f1c48ef6
...
...
@@ -2,7 +2,7 @@
<module
type=
"PYTHON_MODULE"
version=
"4"
>
<component
name=
"NewModuleRootManager"
>
<content
url=
"file://$MODULE_DIR$"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.6 (
physical1
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"jdk"
jdkName=
"Python 3.6 (
LiXiaoFang
)"
jdkType=
"Python SDK"
/>
<orderEntry
type=
"sourceFolder"
forTests=
"false"
/>
</component>
<component
name=
"TestRunnerService"
>
...
...
injection/data_sync/tasks.py
View file @
f1c48ef6
...
...
@@ -132,3 +132,26 @@ def get_tag_count():
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
def
del_pictorial_read_ten_redis
():
try
:
now
=
datetime
.
datetime
.
now
()
.
date
()
yes_time
=
now
-
datetime
.
timedelta
(
days
=
10
)
logging
.
info
(
"get yes_time:
%
s"
%
yes_time
)
device_id
=
"123456"
redis_key
=
"physical:home_recommend_pictorial"
+
":device_id:"
+
str
(
device_id
)
logging
.
info
(
"get redis:
%
s"
%
redis_key
)
redis_question_val_list
=
redis_client
.
hgetall
(
redis_key
)
logging
.
info
(
"get redis_question_val_list:
%
s"
%
redis_question_val_list
)
for
item
in
redis_question_val_list
:
items
=
item
.
encode
(
encoding
=
'utf-8'
)
if
items
<
str
(
yes_time
):
redis_client
.
hdel
(
redis_key
,
item
)
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
libs/es.py
View file @
f1c48ef6
...
...
@@ -414,7 +414,9 @@ class ESPerform(object):
"include"
:
[
"id"
,
"user_id"
]
},
"sort"
:
[
{
"latest_reply_time"
:
{
"order"
:
"desc"
}},
{
"_score"
:
{
"order"
:
"desc"
}},
{
"latest_reply_time"
:{
"order"
:
"desc"
}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"language_type"
:
{
"order"
:
"asc"
}},
],
...
...
linucb/views/collect_data.py
View file @
f1c48ef6
...
...
@@ -159,7 +159,6 @@ class CollectData(object):
click_topic_tag_list
=
list
()
if
"on_click_feed_topic_card"
==
raw_val_dict
[
"type"
]:
topic_id
=
raw_val_dict
[
"params"
][
"topic_id"
]
device_id
=
raw_val_dict
[
"device"
][
"device_id"
]
user_id
=
raw_val_dict
[
"user_id"
]
if
"user_id"
in
raw_val_dict
else
None
...
...
search/utils/group.py
View file @
f1c48ef6
...
...
@@ -47,7 +47,8 @@ class GroupUtils(object):
return
{
"total_count"
:
0
,
"hits"
:
[]}
@classmethod
def
get_hot_pictorial_recommend_result_list
(
cls
,
offset
,
size
,
es_cli_obj
=
None
,
attention_tag_list
=
[]):
def
get_hot_pictorial_recommend_result_list
(
cls
,
offset
,
size
,
es_cli_obj
=
None
,
attention_tag_list
=
[],
have_read_pictorial_id_list
=
[]):
try
:
if
not
es_cli_obj
:
es_cli_obj
=
ESPerform
.
get_cli
()
...
...
@@ -92,7 +93,8 @@ class GroupUtils(object):
{
"term"
:
{
"effective"
:
True
}}
],
"must_not"
:
[
{
"term"
:
{
"is_default"
:
1
}}
{
"term"
:
{
"is_default"
:
1
}},
# {"terms": {"id": have_read_pictorial_id_list}}
]
}
},
...
...
@@ -123,6 +125,10 @@ class GroupUtils(object):
"includes"
:
[
"id"
]
}
if
have_read_pictorial_id_list
:
q
[
"query"
][
"function_score"
][
"query"
][
"bool"
][
"must_not"
]
.
append
(
{
"terms"
:
{
"id"
:
have_read_pictorial_id_list
}})
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"pictorial"
,
q
,
offset
,
size
)
pictorial_ids_list
=
[]
...
...
search/utils/topic.py
View file @
f1c48ef6
...
...
@@ -738,10 +738,11 @@ class TopicUtils(object):
}
# "includes": ["id", "pictorial_id", "user_id", "_score", "create_time", "content_level"]
# q['sort'] = [
q
[
'sort'
]
=
[
{
"latest_reply_time"
:
{
"order"
:
"desc"
}},
# {"content_level": {"order": "desc"}},
# {"create_time": {"order": "desc"}}
#
]
]
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
sub_index_name
=
index_type
,
query_body
=
q
,
size
=
size
,
routing
=
routing
)
...
...
@@ -1146,6 +1147,7 @@ class TopicUtils(object):
if
sorts
:
q
[
"sort"
]
=
sorts
logging
.
info
(
"get --------qqqq:
%
s"
%
q
)
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
index_name
,
query_body
=
q
,
offset
=
offset
,
size
=
size
...
...
search/views/group.py
View file @
f1c48ef6
This diff is collapsed.
Click to expand it.
search/views/search_hotword.py
View file @
f1c48ef6
...
...
@@ -41,7 +41,7 @@ def search_hotword(device_id=-1):
for
item
in
results_registr_tag
:
for
word
in
item
.
split
():
tag_val_list
.
add
(
word
)
tag_id_list
=
random
.
sample
(
range
(
0
,
len
(
tag_val_list
)),
6
)
tag_id_list
=
random
.
sample
(
range
(
0
,
len
(
tag_val_list
)),
1
)
for
tag_id
in
tag_id_list
:
tag_val
=
list
(
tag_val_list
)[
tag_id
]
all_tag_name_list
.
add
(
tag_val
)
...
...
trans2es/mapping/topic-high-star.json
View file @
f1c48ef6
...
...
@@ -19,6 +19,7 @@
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"share_num"
:{
"type"
:
"long"
},
...
...
trans2es/mapping/topic-star-routing.json
View file @
f1c48ef6
...
...
@@ -8,19 +8,19 @@
"vote_num"
:{
"type"
:
"long"
},
"total_vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"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"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
//帖子用户名
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"analyzer"
:
"keyword"
},
//不切词的用户名
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"offline_score"
:{
"type"
:
"double"
},
//离线算分
...
...
@@ -45,14 +45,14 @@
"platform"
:
{
"type"
:
"long"
},
"platform_id"
:
{
"type"
:
"long"
},
"drop_score"
:{
"type"
:
"
double
"
},
//
人工降分
"drop_score"
:{
"type"
:
"
long
"
},
//
人工降分
"sort_score"
:{
"type"
:
"double"
},
//
排序分
"pictorial_id"
:{
"type"
:
"long"
},
//所在组ID
"pictorial_name"
:{
//
所在组名称
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index
"
,
"search_analyzer"
:
"
gm_default_index
"
"analyzer"
:
"
keyword
"
,
"search_analyzer"
:
"
keyword
"
},
"is_excellent"
:{
"type"
:
"long"
},
"is_operation_home_recommend"
:
{
"type"
:
"boolean"
},
//是否首页运营推荐
...
...
trans2es/mapping/topic.json
View file @
f1c48ef6
...
...
@@ -8,19 +8,20 @@
"vote_num"
:{
"type"
:
"long"
},
"total_vote_num"
:{
"type"
:
"long"
},
"reply_num"
:{
"type"
:
"long"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"name"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"description"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"content"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"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"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
//帖子用户名
"user_nick_name_pre"
:
{
"type"
:
"text"
,
"analyzer"
:
"keyword"
},
//不切词的用户名
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"useful_tag_list"
:{
"type"
:
"long"
},
//有用标签属性
"latest_reply_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"edit_tag_list"
:{
"type"
:
"long"
},
//编辑标签
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index"
,
"search_analyzer"
:
"gm_default_index
"
},
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"
keyword"
,
"search_analyzer"
:
"keyword
"
},
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"offline_score"
:{
"type"
:
"double"
},
//离线算分
...
...
@@ -45,14 +46,14 @@
"platform"
:
{
"type"
:
"long"
},
"platform_id"
:
{
"type"
:
"long"
},
"drop_score"
:{
"type"
:
"
double
"
},
//
人工降分
"drop_score"
:{
"type"
:
"
long
"
},
//
人工降分
"sort_score"
:{
"type"
:
"double"
},
//
排序分
"pictorial_id"
:{
"type"
:
"long"
},
//所在组ID
"pictorial_name"
:{
//
所在组名称
"type"
:
"text"
,
"analyzer"
:
"
gm_default_index
"
,
"search_analyzer"
:
"
gm_default_index
"
"analyzer"
:
"
keyword
"
,
"search_analyzer"
:
"
keyword
"
},
"is_excellent"
:{
"type"
:
"long"
},
"is_operation_home_recommend"
:
{
"type"
:
"boolean"
},
//是否首页运营推荐
...
...
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