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
cba9438c
Commit
cba9438c
authored
Dec 13, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
43904484
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
3 deletions
+14
-3
topic.py
search/utils/topic.py
+1
-0
topic.py
search/views/topic.py
+0
-1
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+10
-2
topic_transfer.py
trans2es/utils/topic_transfer.py
+2
-0
No files found.
search/utils/topic.py
View file @
cba9438c
...
...
@@ -195,6 +195,7 @@ class TopicUtils(object):
'description'
:
200
,
'content'
:
300
,
'name'
:
400
,
'tag_name_list'
:
300
,
}
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
multi_match
=
{
...
...
search/views/topic.py
View file @
cba9438c
...
...
@@ -37,7 +37,6 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
unread_topic_id_list
=
list
()
have_read_topic_id_tuple
=
set
()
logging
.
info
(
"duan add,last_offset_num:
%
d"
%
last_offset_num
)
if
len
(
redis_val_dict
)
>
0
and
offset
>
0
and
user_id
>
0
and
offset
==
last_offset_num
:
topic_id_list
=
json
.
loads
(
redis_val_dict
[
b
"unread_topic_id"
])
+
topic_id_list
have_read_topic_id_tuple
=
set
(
json
.
loads
(
redis_val_dict
[
b
"have_read_topic_id"
]))
...
...
trans2es/mapping/topic.json
View file @
cba9438c
...
...
@@ -13,6 +13,7 @@
"user_id"
:{
"type"
:
"long"
},
"group_id"
:{
"type"
:
"long"
},
//所在组ID
"tag_list"
:{
"type"
:
"long"
},
//标签属性
"tag_name_list"
:{
"type"
:
"text"
,
"analyzer"
:
"gm_default_index"
,
"search_analyzer"
:
"gm_default_index"
},
"share_num"
:{
"type"
:
"long"
},
"pick_id_list"
:{
"type"
:
"long"
},
"offline_score"
:{
"type"
:
"double"
},
//离线算分
...
...
trans2es/models/topic.py
View file @
cba9438c
...
...
@@ -10,7 +10,7 @@ from django.db import models
import
datetime
from
.pick_topic
import
PickTopic
from
.tag
import
TopicTag
from
.tag
import
TopicTag
,
Tag
from
.user_extra
import
UserExtra
from
.group
import
Group
...
...
@@ -75,7 +75,15 @@ class Topic(models.Model):
return
topic_tag_id_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
None
return
[]
def
get_tag_name_list
(
self
,
tag_id_list
):
try
:
query_results
=
Tag
.
objects
.
filter
(
id__in
=
tag_id_list
)
.
values_list
(
"name"
)
return
query_results
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
get_topic_offline_score
(
self
):
try
:
...
...
trans2es/utils/topic_transfer.py
View file @
cba9438c
...
...
@@ -33,6 +33,8 @@ class TopicTransfer(object):
res
[
"pick_id_list"
]
=
instance
.
get_pick_id_info
()
res
[
"tag_list"
]
=
instance
.
get_topic_tag_id_list
()
res
[
"tag_name_list"
]
=
instance
.
get_tag_name_list
(
res
[
"tag_list"
])
res
[
"offline_score"
]
=
instance
.
get_topic_offline_score
()
create_time
=
instance
.
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