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
55d23168
Commit
55d23168
authored
Apr 08, 2019
by
lixiaofang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
780ac9f2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
11 deletions
+7
-11
group.py
search/utils/group.py
+7
-11
No files found.
search/utils/group.py
View file @
55d23168
...
@@ -68,9 +68,7 @@ class GroupUtils(object):
...
@@ -68,9 +68,7 @@ class GroupUtils(object):
q
[
"_source"
]
=
{
q
[
"_source"
]
=
{
"includes"
:
[
"id"
]
"includes"
:
[
"id"
]
}
}
MAX_LOAD
=
100
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"pictorial"
,
q
,
offset
,
size
)
sizes
=
max
(
size
,
MAX_LOAD
)
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"pictorial"
,
q
,
offset
,
sizes
)
pictorial_ids_list
=
[]
pictorial_ids_list
=
[]
if
len
(
result_dict
[
"hits"
])
>
0
:
if
len
(
result_dict
[
"hits"
])
>
0
:
...
@@ -79,7 +77,7 @@ class GroupUtils(object):
...
@@ -79,7 +77,7 @@ class GroupUtils(object):
pictorial_del_ids_list
=
[]
pictorial_del_ids_list
=
[]
if
len
(
pictorial_ids_list
)
>
0
:
if
len
(
pictorial_ids_list
)
>
0
:
for
id
in
pictorial_ids_list
:
for
id
in
pictorial_ids_list
:
q
=
{
q
=
{
"query"
:
{
"query"
:
{
"bool"
:
{
"bool"
:
{
"must"
:
[{
"must"
:
[{
...
@@ -88,7 +86,7 @@ class GroupUtils(object):
...
@@ -88,7 +86,7 @@ class GroupUtils(object):
}
}
},
{
},
{
"terms"
:
{
"terms"
:
{
"content_level"
:
[
3
,
4
,
5
,
0
]
"content_level"
:
[
3
,
4
,
5
,
0
]
}
}
},
{
},
{
"term"
:
{
"term"
:
{
...
@@ -115,7 +113,6 @@ class GroupUtils(object):
...
@@ -115,7 +113,6 @@ class GroupUtils(object):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
return
[]
@classmethod
@classmethod
def
get_user_attention_pictorial_list
(
cls
,
user_id
,
offset
=
0
,
size
=
10
,
es_cli_obj
=
None
):
def
get_user_attention_pictorial_list
(
cls
,
user_id
,
offset
=
0
,
size
=
10
,
es_cli_obj
=
None
):
"""
"""
...
@@ -139,10 +136,10 @@ class GroupUtils(object):
...
@@ -139,10 +136,10 @@ class GroupUtils(object):
q
[
"_source"
]
=
{
q
[
"_source"
]
=
{
"includes"
:
[
"attention_pictorial_id_list"
]
"includes"
:
[
"attention_pictorial_id_list"
]
}
}
MAX_LOAD
=
100
#
MAX_LOAD = 100
sizes
=
max
(
size
,
MAX_LOAD
)
#
sizes = max(size, MAX_LOAD)
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"user"
,
q
,
offset
,
size
s
)
result_dict
=
ESPerform
.
get_search_results
(
es_cli_obj
,
"user"
,
q
,
offset
,
size
)
pictorial_ids_list
=
[]
pictorial_ids_list
=
[]
if
len
(
result_dict
[
"hits"
])
>
0
:
if
len
(
result_dict
[
"hits"
])
>
0
:
pictorial_ids_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"attention_pictorial_id_list"
]
pictorial_ids_list
=
result_dict
[
"hits"
][
0
][
"_source"
][
"attention_pictorial_id_list"
]
...
@@ -159,7 +156,7 @@ class GroupUtils(object):
...
@@ -159,7 +156,7 @@ class GroupUtils(object):
}
}
},
{
},
{
"terms"
:
{
"terms"
:
{
"content_level"
:
[
3
,
4
,
5
,
0
]
"content_level"
:
[
3
,
4
,
5
,
0
]
}
}
},
{
},
{
"term"
:
{
"term"
:
{
...
@@ -187,7 +184,6 @@ class GroupUtils(object):
...
@@ -187,7 +184,6 @@ class GroupUtils(object):
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
return
[]
@classmethod
@classmethod
def
get_pictorial_ids_by_aggs
(
cls
,
pictorial_ids_list
,
es_cli_obj
=
None
):
def
get_pictorial_ids_by_aggs
(
cls
,
pictorial_ids_list
,
es_cli_obj
=
None
):
"""
"""
...
...
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