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
f896baad
Commit
f896baad
authored
Jun 28, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改排序逻辑
parent
a298c7b8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
7 deletions
+31
-7
topic.py
search/utils/topic.py
+31
-7
No files found.
search/utils/topic.py
View file @
f896baad
...
@@ -875,7 +875,7 @@ class TopicUtils(object):
...
@@ -875,7 +875,7 @@ class TopicUtils(object):
return
nf
return
nf
@classmethod
@classmethod
def
process_sort
(
cls
,
sorts_by
):
def
process_sort
(
cls
,
sorts_by
,
pictorial_id
):
"""处理排序部分。"""
"""处理排序部分。"""
sort_rule
=
[]
sort_rule
=
[]
...
@@ -932,7 +932,13 @@ class TopicUtils(object):
...
@@ -932,7 +932,13 @@ class TopicUtils(object):
sort_rule
.
append
({
sort_rule
.
append
({
"related_billboard.real_vote_cnt"
:
{
"related_billboard.real_vote_cnt"
:
{
"order"
:
"asc"
,
"order"
:
"asc"
,
"nested_path"
:
"related_billboard"
"nested_path"
:
"related_billboard"
,
"missing"
:
"_last"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
},
},
})
})
...
@@ -940,24 +946,42 @@ class TopicUtils(object):
...
@@ -940,24 +946,42 @@ class TopicUtils(object):
sort_rule
.
append
({
sort_rule
.
append
({
"related_billboard.real_vote_cnt"
:
{
"related_billboard.real_vote_cnt"
:
{
"order"
:
"desc"
,
"order"
:
"desc"
,
"nested_path"
:
"related_billboard"
"nested_path"
:
"related_billboard"
,
"missing"
:
"_last"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
},
},
})
})
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VIRT_VOTE_AEC
:
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VIRT_VOTE_AEC
:
sort_rule
.
append
({
sort_rule
.
append
({
"related_billboard.virt_vote_cnt"
:
{
"related_billboard.virt_vote_cnt"
:
{
"order"
:
"asc"
,
"order"
:
"asc"
,
"nested_path"
:
"related_billboard"
"nested_path"
:
"related_billboard"
,
"missing"
:
"_last"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
},
},
})
})
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VIRT_VOTE_DESC
:
elif
sort_by
==
TOPIC_SEARCH_SORT
.
VIRT_VOTE_DESC
:
sort_rule
.
append
({
sort_rule
.
append
({
"related_billboard.virt_vote_cnt"
:
{
"related_billboard.virt_vote_cnt"
:
{
"order"
:
"desc"
,
"order"
:
"desc"
,
"nested_path"
:
"related_billboard"
"nested_path"
:
"related_billboard"
,
"missing"
:
"_last"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
},
},
})
})
return
sort_rule
return
sort_rule
@classmethod
@classmethod
...
@@ -974,7 +998,7 @@ class TopicUtils(object):
...
@@ -974,7 +998,7 @@ class TopicUtils(object):
}
}
if
sorts_by
:
if
sorts_by
:
sorts
=
cls
.
process_sort
(
sorts_by
)
sorts
=
cls
.
process_sort
(
sorts_by
,
pictorial_id
=
None
)
if
sorts
:
if
sorts
:
q
[
"sort"
]
=
sorts
q
[
"sort"
]
=
sorts
...
...
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