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
8f97c7bf
Commit
8f97c7bf
authored
Sep 29, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gyz_topic_ctr_all' into 'master'
lin回答和lin问题的排序逻辑更改(30天内和历史) See merge request
!509
parents
ff979cae
379d23ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
15 deletions
+14
-15
es.py
libs/es.py
+13
-14
tools.py
libs/tools.py
+1
-1
No files found.
libs/es.py
View file @
8f97c7bf
...
...
@@ -415,14 +415,14 @@ class ESPerform(object):
}
},
"_source"
:
{
"include"
:
[
"id"
,
"user_id"
,
"latest_reply_time"
,
"topic_ctr_30"
,
"
like_rate_30
"
]
"include"
:
[
"id"
,
"user_id"
,
"latest_reply_time"
,
"topic_ctr_30"
,
"
topic_ctr_all"
,
"like_rate_30"
,
"like_rate_all
"
]
},
"sort"
:
[
{
"_script"
:
{
"order"
:
"desc"
,
"script"
:
{
"inline"
:
"
5*doc['topic_ctr_30'].value+doc['like_rate_30'].value
"
"inline"
:
"
10*doc['topic_ctr_30'].value+doc['like_rate_30'].value+2*doc.['topic_ctr_all']+doc['like_rate_all']
"
},
"type"
:
"number"
}
...
...
@@ -452,16 +452,7 @@ class ESPerform(object):
topic_id_dict
=
dict
()
for
item
in
result_dict
[
"hits"
]:
topic_id_dict
[
str
(
item
[
"_source"
][
"id"
])]
=
item
[
"_source"
][
"user_id"
]
topic_id_dict_latest_reply_time
=
list
()
for
item
in
result_dict
[
"hits"
]:
topic_id_dict_latest_reply_time
.
append
([
item
[
"_source"
][
"id"
],
item
[
"_source"
][
"latest_reply_time"
]])
logging
.
info
(
"topic_id_list:
%
s"
%
str
(
topic_id_dict
))
logging
.
info
(
"get_tag_topic_list_dict:gyz"
+
str
(
q
)
+
str
(
result_dict
))
logging
.
info
(
"linucb_tag_id_list_2_same_tagset_ids_2_topics_detail:"
+
str
(
topic_id_dict_latest_reply_time
))
return
topic_id_list
,
topic_id_dict
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
@@ -548,9 +539,18 @@ class ESPerform(object):
}
},
"_source"
:
{
"include"
:
[
"id"
]
"include"
:
[
"id"
,
"real_user_activate_time"
,
"create_time"
,
"pictorial_ctr_30"
,
"pictorial_ctr_all"
,
"like_rate_30"
,
"like_rate_all"
]
},
"sort"
:
[
{
"_script"
:
{
"order"
:
"desc"
,
"script"
:
{
"inline"
:
"5*doc['pictorial_ctr_30'].value+3*doc['like_rate_30'].value+doc.['pictorial_ctr_all']+doc['like_rate_all']"
},
"type"
:
"number"
}
},
{
"real_user_activate_time"
:
{
"order"
:
"desc"
}},
{
"create_time"
:
{
"order"
:
"desc"
}},
],
...
...
@@ -567,8 +567,7 @@ class ESPerform(object):
offset
=
0
,
size
=
size
)
pictorial_id_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
[
"hits"
]]
# logging.info("topic_id_list:%s" % str(topic_id_list))
# topic_id_dict = [{str(item["_source"]["id"]):item["_source"]["user_id"]} for item in result_dict["hits"]]
logging
.
info
(
"get_tag_pictorial_id_list:gyz"
+
str
(
q
)
+
str
(
result_dict
))
return
pictorial_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
...
...
libs/tools.py
View file @
8f97c7bf
...
...
@@ -66,5 +66,5 @@ def is_connection_usable():
connection
.
connection
.
ping
()
return
True
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
#
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return
False
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