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
60abc391
Commit
60abc391
authored
Jul 11, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zuixin' into 'master'
Zuixin See merge request
!386
parents
acf4c8e0
6eebbfee
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
16 deletions
+53
-16
topic.py
search/utils/topic.py
+26
-8
topic-high-star.json
trans2es/mapping/topic-high-star.json
+4
-0
topic-star-routing.json
trans2es/mapping/topic-star-routing.json
+4
-0
topic-star.json
trans2es/mapping/topic-star.json
+4
-0
topic-v1.json
trans2es/mapping/topic-v1.json
+4
-0
topic.json
trans2es/mapping/topic.json
+1
-0
topic.py
trans2es/models/topic.py
+10
-8
No files found.
search/utils/topic.py
View file @
60abc391
...
...
@@ -251,9 +251,9 @@ class TopicUtils(object):
]
if
query
is
not
None
:
# 搜索帖子
multi_fields
=
{
#'description': 200,
#
'description': 200,
'content'
:
300
,
#'name': 400,
#
'name': 400,
'tag_name_list'
:
300
,
}
query_fields
=
[
'^'
.
join
((
k
,
str
(
v
)))
for
(
k
,
v
)
in
multi_fields
.
items
()]
...
...
@@ -329,18 +329,18 @@ class TopicUtils(object):
'query'
:
query
,
'type'
:
'best_fields'
,
'operator'
:
'and'
,
'fields'
:
[
"content"
,
"tag_name_list"
],
'fields'
:
[
"content"
,
"tag_name_list"
],
}
functions_list
+=
[
{
"weight"
:
300
,
"filter"
:{
"bool"
:{
"must"
:{
"filter"
:
{
"bool"
:
{
"must"
:
{
"term"
:
{
"content_level"
:
6
},
},
"minimum_should_match"
:
1
,
"should"
:[
"should"
:
[
{
'multi_match'
:
multi_match
},
{
"term"
:
{
"tag_list"
:
tag_id
}},
{
"term"
:
{
"user_nick_name_pre"
:
query
.
lower
()}}
...
...
@@ -973,7 +973,18 @@ class TopicUtils(object):
"order"
:
"desc"
},
})
if
sorts_by
==
TOPIC_SEARCH_SORT
.
TOPIC_ADD_TIME
:
sort_rule
.
append
({
"related_billboard.topic_add_createtime"
:
{
"order"
:
"desc"
,
"nested_path"
:
"related_billboard"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
},
})
elif
isinstance
(
sorts_by
,
list
):
for
sort_by
in
sorts_by
:
if
sort_by
==
TOPIC_SEARCH_SORT
.
ID_AEC
:
...
...
@@ -1067,6 +1078,7 @@ class TopicUtils(object):
}
},
})
logging
.
info
(
"get picotirial:
%
s"
%
sort_rule
)
return
sort_rule
...
...
@@ -1084,6 +1096,12 @@ class TopicUtils(object):
}
}
if
'pictorial_id'
in
filters
.
keys
():
if
sorts_by
:
sorts
=
cls
.
process_sort
(
sorts_by
,
filters
[
"pictorial_id"
])
if
sorts
:
q
[
"sort"
]
=
sorts
else
:
if
sorts_by
:
sorts
=
cls
.
process_sort
(
sorts_by
,
pictorial_id
=
None
)
if
sorts
:
...
...
trans2es/mapping/topic-high-star.json
View file @
60abc391
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_createtime"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
@@ -67,3 +68,6 @@
}
}
}
trans2es/mapping/topic-star-routing.json
View file @
60abc391
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_createtime"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
@@ -67,3 +68,6 @@
}
}
}
trans2es/mapping/topic-star.json
View file @
60abc391
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_createtime"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
@@ -67,3 +68,6 @@
}
}
}
trans2es/mapping/topic-v1.json
View file @
60abc391
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_createtime"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
@@ -67,3 +68,6 @@
}
}
}
trans2es/mapping/topic.json
View file @
60abc391
...
...
@@ -60,6 +60,7 @@
"type"
:
"nested"
,
"properties"
:{
"pictorial_id"
:{
"type"
:
"long"
},
"topic_add_createtime"
:{
"type"
:
"long"
},
"real_vote_cnt"
:{
"type"
:
"long"
},
"virt_vote_cnt"
:{
"type"
:
"long"
},
"total_vote_cnt"
:{
"type"
:
"long"
}
...
...
trans2es/models/topic.py
View file @
60abc391
...
...
@@ -282,26 +282,28 @@ class Topic(models.Model):
def
get_related_billboard
(
self
):
try
:
pictorial_ids
=
Topic
.
get_pictorial_id
(
self
)
related_billboard_list
=
list
()
for
pictorial_id
in
pictorial_ids
:
pictorials
=
PictorialTopic
.
objects
.
filter
(
topic_id
=
self
.
id
)
.
values
(
"pictorial_id"
,
"create_time"
)
for
pictorial_id
in
pictorials
:
query_result
=
TopicBillBoard
.
objects
.
filter
(
pictorial_id
=
pictorial_id
,
query_result
=
TopicBillBoard
.
objects
.
filter
(
pictorial_id
=
pictorial_id
.
get
(
'pictorial_id'
,
None
)
,
topic_id
=
self
.
id
)
.
values
()
.
first
()
if
query_result
==
None
:
related_billboard_list
.
append
({
"pictorial_id"
:
pictorial_id
,
"real_vote_cnt"
:
0
,
"virt_vote_cnt"
:
0
,
"total_vote_cnt"
:
0
})
related_billboard_list
.
append
(
{
"pictorial_id"
:
pictorial_id
.
get
(
'pictorial_id'
,
None
),
"real_vote_cnt"
:
0
,
"virt_vote_cnt"
:
0
,
"total_vote_cnt"
:
0
,
"topic_add_createtime"
:
int
(
time
.
mktime
(
pictorial_id
.
get
(
"create_time"
,
None
)
.
timetuple
()))})
else
:
total_vote_cnt
=
int
(
query_result
[
"virt_vote_cnt"
])
+
int
(
query_result
[
"real_vote_cnt"
])
related_billboard_list
.
append
(
{
"pictorial_id"
:
query_result
[
"pictorial_id"
],
"real_vote_cnt"
:
query_result
[
"real_vote_cnt"
],
"virt_vote_cnt"
:
query_result
[
"virt_vote_cnt"
],
"total_vote_cnt"
:
total_vote_cnt
})
"virt_vote_cnt"
:
query_result
[
"virt_vote_cnt"
],
"total_vote_cnt"
:
total_vote_cnt
,
"topic_add_createtime"
:
int
(
time
.
mktime
(
pictorial_id
.
get
(
"create_time"
,
None
)
.
timetuple
()))})
logging
.
info
(
"product_brand_info"
%
related_billboard_list
)
...
...
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