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
254ad39f
Commit
254ad39f
authored
Dec 20, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
ccf30506
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
topic.py
search/utils/topic.py
+9
-0
topic.py
search/views/topic.py
+16
-0
tag_transfer.py
trans2es/utils/tag_transfer.py
+3
-3
No files found.
search/utils/topic.py
View file @
254ad39f
...
...
@@ -323,6 +323,14 @@ class TopicUtils(object):
tag_id_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
TopicDocumentField
.
TAG_LIST
]
return
tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
@classmethod
def
get_tag_aggregation_topic_id_list
(
cls
):
try
:
return
list
()
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
\ No newline at end of file
search/views/topic.py
View file @
254ad39f
...
...
@@ -167,3 +167,19 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
return
{
"recommend_topic_ids"
:
[]}
@bind
(
"physical/search/tag_aggregation"
)
def
tag_aggregation
(
tag_id
,
offset
,
size
):
"""
:remark 按标签聚合召回帖子
:param tag_id:
:param offset:
:param size:
:return:
"""
try
:
return
{
"recommend_topic_id"
:
[]}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_id"
:
[]}
trans2es/utils/tag_transfer.py
View file @
254ad39f
...
...
@@ -26,16 +26,16 @@ class TagTransfer(object):
if
instance
.
is_online
==
True
and
instance
.
is_deleted
==
False
:
topic_id_list
=
list
()
sql_result_list
=
TopicTag
.
objects
.
filter
(
tag_id
=
instance
.
id
,
is_online
=
True
)
.
values_list
(
"topic_id"
,
flat
=
True
)
sql_result_list
=
TopicTag
.
objects
.
filter
(
tag_id
=
instance
.
id
)
.
values_list
(
"topic_id"
,
flat
=
True
)
for
item_id
in
sql_result_list
:
topic_id_list
.
append
(
item_id
)
time_base_val
=
datetime
.
datetime
.
strftime
(
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
-
7
),
"
%
Y-
%
m-
%
d"
)
topic_num
=
Topic
.
objects
.
filter
(
id__in
=
topic_id_list
,
is_online
=
True
,
is_deleted
=
False
,
create_time__gte
=
time_base_val
)
.
count
()
topic_num
=
Topic
.
objects
.
filter
(
id__in
=
topic_id_list
,
create_time__gte
=
time_base_val
)
.
count
()
res
[
"near_new_topic_num"
]
=
topic_num
tag_type_sql_list
=
CommunityTagTypeRelation
.
objects
.
filter
(
tag_id
=
instance
.
id
,
is_online
=
True
,
is_deleted
=
False
)
.
values_list
(
"tag_type_id"
,
flat
=
True
)
tag_type_sql_list
=
CommunityTagTypeRelation
.
objects
.
filter
(
tag_id
=
instance
.
id
)
.
values_list
(
"tag_type_id"
,
flat
=
True
)
tag_type_list
=
list
()
for
tag_type_id
in
tag_type_sql_list
:
tag_type_list
.
append
(
tag_type_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