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
821090cd
Commit
821090cd
authored
Dec 20, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
c8615822
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
11 deletions
+20
-11
topic.py
search/utils/topic.py
+10
-9
topic.py
search/views/topic.py
+7
-2
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+1
-0
topic_transfer.py
trans2es/utils/topic_transfer.py
+1
-0
No files found.
search/utils/topic.py
View file @
821090cd
...
...
@@ -344,9 +344,6 @@ class TopicUtils(object):
pick_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"pick_user_id_list"
]
pick_user_id_list
=
[
item
[
"user_id"
]
for
item
in
pick_user_info_list
]
q
=
dict
()
q
[
"query"
]
=
dict
()
functions_list
=
[
{
"gauss"
:
{
...
...
@@ -391,9 +388,12 @@ class TopicUtils(object):
"functions"
:
functions_list
}
q
[
"query"
][
"function_score"
]
=
query_function_score
q
=
dict
()
q
[
"query"
]
=
{
"function_score"
:
query_function_score
}
q
[
"_source"
]
=
{
"include"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
]
"include"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
,
"offline_score"
,
"manual_score"
]
}
q
[
"sort"
]
=
[
{
...
...
@@ -401,8 +401,9 @@ class TopicUtils(object):
"type"
:
"number"
,
"script"
:{
"lang"
:
"painless"
,
"source"
:
"_score"
}
"source"
:
"_score+params._source.offline_score+params._source.manual_score"
},
"order"
:
"desc"
}
}
]
...
...
@@ -410,8 +411,7 @@ class TopicUtils(object):
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
offset
=
offset
,
size
=
size
)
return
list
()
return
result_dict
[
"hits"
]
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 @
821090cd
...
...
@@ -168,7 +168,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
@bind
(
"physical/search/tag_aggregation"
)
def
tag_aggregation
(
tag_id
,
offset
,
size
):
def
tag_aggregation
(
user_id
,
tag_id
,
offset
,
size
):
"""
:remark 按标签聚合召回帖子
:param tag_id:
...
...
@@ -177,7 +177,12 @@ def tag_aggregation(tag_id, offset, size):
:return:
"""
try
:
return
{
"recommend_topic_id"
:
[]}
result_list
=
TopicUtils
.
get_tag_aggregation_topic_id_list
(
user_id
,
tag_id
,
offset
,
size
)
recommend_topic_ids_list
=
list
()
if
len
(
result_list
)
>
0
:
recommend_topic_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_list
]
return
{
"recommend_topic_id"
:
recommend_topic_ids_list
}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_id"
:
[]}
...
...
trans2es/mapping/topic.json
View file @
821090cd
...
...
@@ -17,6 +17,7 @@
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"offline_score"
:{
"type"
:
"double"
},
//离线算分
"manual_score"
:{
"type"
:
"double"
},
//人工赋分
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"create_time_val"
:{
"type"
:
"long"
},
...
...
trans2es/models/topic.py
View file @
821090cd
...
...
@@ -39,6 +39,7 @@ class Topic(models.Model):
group
=
models
.
ForeignKey
(
Group
,
verbose_name
=
u"关联的小组"
,
related_name
=
u"group_topics"
,
null
=
True
,
blank
=
True
,
default
=
None
,
on_delete
=
models
.
CASCADE
)
user_id
=
models
.
IntegerField
(
verbose_name
=
'用户ID'
)
drop_score
=
models
.
IntegerField
(
verbose_name
=
u'人工赋分'
)
description
=
models
.
CharField
(
verbose_name
=
'日记本描述'
,
max_length
=
200
)
content
=
models
.
CharField
(
verbose_name
=
'日记本内容'
,
max_length
=
1000
)
share_num
=
models
.
IntegerField
(
verbose_name
=
''
)
...
...
trans2es/utils/topic_transfer.py
View file @
821090cd
...
...
@@ -36,6 +36,7 @@ class TopicTransfer(object):
res
[
"tag_name_list"
]
=
instance
.
get_tag_name_list
(
res
[
"tag_list"
])
res
[
"offline_score"
]
=
instance
.
get_topic_offline_score
()
res
[
"manual_score"
]
=
instance
.
drop_score
create_time
=
instance
.
create_time
tzlc_create_time
=
tzlc
(
create_time
)
...
...
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