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
Show 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):
...
@@ -344,9 +344,6 @@ class TopicUtils(object):
pick_user_info_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"pick_user_id_list"
]
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
]
pick_user_id_list
=
[
item
[
"user_id"
]
for
item
in
pick_user_info_list
]
q
=
dict
()
q
[
"query"
]
=
dict
()
functions_list
=
[
functions_list
=
[
{
{
"gauss"
:
{
"gauss"
:
{
...
@@ -391,9 +388,12 @@ class TopicUtils(object):
...
@@ -391,9 +388,12 @@ class TopicUtils(object):
"functions"
:
functions_list
"functions"
:
functions_list
}
}
q
[
"query"
][
"function_score"
]
=
query_function_score
q
=
dict
()
q
[
"query"
]
=
{
"function_score"
:
query_function_score
}
q
[
"_source"
]
=
{
q
[
"_source"
]
=
{
"include"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
]
"include"
:[
"id"
,
"group_id"
,
"user_id"
,
"_score"
,
"offline_score"
,
"manual_score"
]
}
}
q
[
"sort"
]
=
[
q
[
"sort"
]
=
[
{
{
...
@@ -401,8 +401,9 @@ class TopicUtils(object):
...
@@ -401,8 +401,9 @@ class TopicUtils(object):
"type"
:
"number"
,
"type"
:
"number"
,
"script"
:{
"script"
:{
"lang"
:
"painless"
,
"lang"
:
"painless"
,
"source"
:
"_score"
"source"
:
"_score+params._source.offline_score+params._source.manual_score"
}
},
"order"
:
"desc"
}
}
}
}
]
]
...
@@ -410,8 +411,7 @@ class TopicUtils(object):
...
@@ -410,8 +411,7 @@ class TopicUtils(object):
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
sub_index_name
=
"topic"
,
query_body
=
q
,
offset
=
offset
,
size
=
size
)
offset
=
offset
,
size
=
size
)
return
result_dict
[
"hits"
]
return
list
()
except
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
list
()
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
...
@@ -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"
)
@bind
(
"physical/search/tag_aggregation"
)
def
tag_aggregation
(
tag_id
,
offset
,
size
):
def
tag_aggregation
(
user_id
,
tag_id
,
offset
,
size
):
"""
"""
:remark 按标签聚合召回帖子
:remark 按标签聚合召回帖子
:param tag_id:
:param tag_id:
...
@@ -177,7 +177,12 @@ def tag_aggregation(tag_id, offset, size):
...
@@ -177,7 +177,12 @@ def tag_aggregation(tag_id, offset, size):
:return:
:return:
"""
"""
try
:
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
:
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"recommend_topic_id"
:
[]}
return
{
"recommend_topic_id"
:
[]}
...
...
trans2es/mapping/topic.json
View file @
821090cd
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
"share_num"
:{
"type"
:
"long"
},
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"offline_score"
:{
"type"
:
"double"
},
//离线算分
"offline_score"
:{
"type"
:
"double"
},
//离线算分
"manual_score"
:{
"type"
:
"double"
},
//人工赋分
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"create_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"update_time"
:{
"type"
:
"date"
,
"format"
:
"date_time_no_millis"
},
"create_time_val"
:{
"type"
:
"long"
},
"create_time_val"
:{
"type"
:
"long"
},
...
...
trans2es/models/topic.py
View file @
821090cd
...
@@ -39,6 +39,7 @@ class Topic(models.Model):
...
@@ -39,6 +39,7 @@ class Topic(models.Model):
group
=
models
.
ForeignKey
(
group
=
models
.
ForeignKey
(
Group
,
verbose_name
=
u"关联的小组"
,
related_name
=
u"group_topics"
,
null
=
True
,
blank
=
True
,
default
=
None
,
on_delete
=
models
.
CASCADE
)
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'
)
user_id
=
models
.
IntegerField
(
verbose_name
=
'用户ID'
)
drop_score
=
models
.
IntegerField
(
verbose_name
=
u'人工赋分'
)
description
=
models
.
CharField
(
verbose_name
=
'日记本描述'
,
max_length
=
200
)
description
=
models
.
CharField
(
verbose_name
=
'日记本描述'
,
max_length
=
200
)
content
=
models
.
CharField
(
verbose_name
=
'日记本内容'
,
max_length
=
1000
)
content
=
models
.
CharField
(
verbose_name
=
'日记本内容'
,
max_length
=
1000
)
share_num
=
models
.
IntegerField
(
verbose_name
=
''
)
share_num
=
models
.
IntegerField
(
verbose_name
=
''
)
...
...
trans2es/utils/topic_transfer.py
View file @
821090cd
...
@@ -36,6 +36,7 @@ class TopicTransfer(object):
...
@@ -36,6 +36,7 @@ class TopicTransfer(object):
res
[
"tag_name_list"
]
=
instance
.
get_tag_name_list
(
res
[
"tag_list"
])
res
[
"tag_name_list"
]
=
instance
.
get_tag_name_list
(
res
[
"tag_list"
])
res
[
"offline_score"
]
=
instance
.
get_topic_offline_score
()
res
[
"offline_score"
]
=
instance
.
get_topic_offline_score
()
res
[
"manual_score"
]
=
instance
.
drop_score
create_time
=
instance
.
create_time
create_time
=
instance
.
create_time
tzlc_create_time
=
tzlc
(
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