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
b0820ff1
Commit
b0820ff1
authored
Sep 24, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lin新帖保量,按最新回复时间排序,下发后redis pub;lin老帖增加ctr+like排序;首页增加lin新帖参数与返回值
parent
ab74ef6f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
es.py
libs/es.py
+61
-0
topic.py
search/views/topic.py
+0
-0
No files found.
libs/es.py
View file @
b0820ff1
...
...
@@ -401,6 +401,7 @@ class ESPerform(object):
{
"term"
:
{
"content_level"
:
6
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}},
{
"term"
:
{
"is_new_topic"
:
False
}},
{
"terms"
:
{
"tag_list"
:
tag_id
}}
]
}
...
...
@@ -414,6 +415,7 @@ class ESPerform(object):
"include"
:
[
"id"
,
"user_id"
,
"latest_reply_time"
]
},
"sort"
:
[
{
"topic_ctr_30"
+
"like_rate_30"
:
{
"order"
:
"desc"
}},
{
"latest_reply_time"
:
{
"order"
:
"desc"
}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"language_type"
:
{
"order"
:
"asc"
}},
...
...
@@ -450,6 +452,65 @@ class ESPerform(object):
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
())
return
list
(),
dict
()
@classmethod
def
get_tag_new_topic_list
(
cls
,
tag_id
,
have_read_topic_id_list
,
size
=
10
):
try
:
functions_list
=
list
()
for
id
in
tag_id
:
functions_list
.
append
(
{
"filter"
:
{
"term"
:
{
"tag_list"
:
id
}},
"weight"
:
1
}
)
q
=
{
"query"
:
{
"function_score"
:
{
"query"
:
{
"bool"
:
{
"must"
:
[
{
"term"
:
{
"content_level"
:
6
}},
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}},
{
"term"
:
{
"is_new_topic"
:
True
}},
{
"terms"
:
{
"tag_list"
:
tag_id
}}
]
}
},
"boost_mode"
:
"sum"
,
"score_mode"
:
"sum"
,
"functions"
:
functions_list
}
},
"_source"
:
{
"include"
:
[
"id"
,
"user_id"
]
},
"sort"
:
[
{
"latest_reply_time"
:
{
"order"
:
"desc"
}},
{
"create_time_val"
:
{
"order"
:
"desc"
}},
{
"language_type"
:
{
"order"
:
"asc"
}},
],
"collapse"
:
{
"field"
:
"user_id"
}
}
if
len
(
have_read_topic_id_list
)
>
0
:
q
[
"query"
][
"function_score"
][
"query"
][
"bool"
][
"must_not"
]
=
{
"terms"
:
{
"id"
:
have_read_topic_id_list
}
}
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic-high-star"
,
query_body
=
q
,
offset
=
0
,
size
=
size
,
routing
=
"6"
)
topic_id_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
[
"hits"
]]
return
topic_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
...
...
search/views/topic.py
View file @
b0820ff1
This diff is collapsed.
Click to expand it.
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