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
钟尚武
physical
Commits
acf4c8e0
Commit
acf4c8e0
authored
Jul 09, 2019
by
段英荣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '720_pictorial' into 'master'
画报新增一个我的投稿tab See merge request
alpha/physical!385
parents
c4378545
2138e3fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
1 deletion
+69
-1
group.py
search/views/group.py
+69
-1
No files found.
search/views/group.py
View file @
acf4c8e0
...
...
@@ -296,7 +296,7 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10):
es_cli_obj
=
ESPerform
.
get_cli
()
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"topic"
,
q
,
offset
,
size
)
logging
.
info
(
"get pictorial_topic_sort res:
%
s"
%
result_dict
)
#
logging.info("get pictorial_topic_sort res:%s" % result_dict)
for
item
in
result_dict
[
"hits"
]:
topic_id
=
item
[
"_source"
][
"id"
]
...
...
@@ -331,3 +331,71 @@ def search_physical(query="", offset=0, size=10):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"search_pictorial_ids"
:
[]}
@bind
(
"physical/search/pictorialid_topic"
)
def
pictorial_topic_sort_peoplehot
(
pictorial_id
=-
1
,
user_id
=-
1
,
offset
=
0
,
size
=
10
):
try
:
if
not
isinstance
(
pictorial_id
,
int
):
pictorial_id
=
-
1
results
=
pictorial_topic_sort
(
pictorial_id
=
pictorial_id
,
size
=
100
)
pict_pictorial_ids_list
=
results
[
"pict_pictorial_ids_list"
]
logging
.
info
(
"get pict_pictorial_ids_list res:
%
s"
%
pict_pictorial_ids_list
)
q
=
{
"query"
:
{
"bool"
:
{
"must"
:
[
{
"term"
:
{
"is_online"
:
True
}},
{
"term"
:
{
"is_deleted"
:
False
}},
{
"term"
:
{
"pictorial_id"
:
pictorial_id
}},
{
"term"
:
{
"user_id"
:
user_id
}}
]
}
},
"sort"
:
[
{
"related_billboard.total_vote_cnt"
:
{
"order"
:
"desc"
,
"nested_path"
:
"related_billboard"
,
"missing"
:
"_last"
,
"nested_filter"
:
{
"term"
:
{
"related_billboard.pictorial_id"
:
pictorial_id
}
}
}},
{
"create_time"
:
{
"order"
:
"desc"
}}
]
}
# 获取es链接对象
es_cli_obj
=
ESPerform
.
get_cli
()
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"topic"
,
q
,
offset
,
size
)
user_pict_pictorial_ids_list
=
[]
for
item
in
result_dict
[
"hits"
]:
topic_id
=
item
[
"_source"
][
"id"
]
user_pict_pictorial_ids_list
.
append
(
topic_id
)
logging
.
info
(
"get user_pict_pictorial_ids_list res:
%
s"
%
user_pict_pictorial_ids_list
)
pictorial_user_topicid_list
=
list
()
for
user_id_topic
in
user_pict_pictorial_ids_list
:
if
user_id_topic
in
pict_pictorial_ids_list
:
topic_sort
=
pict_pictorial_ids_list
.
index
(
user_id_topic
)
pictorial_user_topicid_list
.
append
({
"topic_id"
:
user_id_topic
,
"topic_sort"
:
topic_sort
+
1
})
else
:
index
=
user_pict_pictorial_ids_list
.
index
(
user_id_topic
)
pictorial_user_topicid_list
.
append
({
"topic_id"
:
user_id_topic
,
"topic_sort"
:
100
+
index
})
return
{
"pictorial_user_topicid_list"
:
pictorial_user_topicid_list
}
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"pict_pictorial_ids_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