Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
[Sprint/ModestMonkey](fix) boost console feed
front#1596
· 6a39471b
Ben
authored
Sep 06, 2019
and
Brian Hatchet
committed
Sep 06, 2019
6a39471b
Merge branch 'fix/boost-console-feed-1596' into 'master'
· 66fff05c
Brian Hatchet
authored
Sep 06, 2019
[Sprint/ModestMonkey](fix) boost console feed
front#1596
See merge request
!311
66fff05c
Hide whitespace changes
Inline
Side-by-side
Controllers/api/v2/feeds/container.php
View file @
66fff05c
...
...
@@ -57,6 +57,9 @@ class container implements Interfaces\Api
case
'blogs'
:
$type
=
'object:blog'
;
break
;
case
'all'
:
$type
=
'all'
;
break
;
}
//
...
...
Core/Feeds/Top/Manager.php
View file @
66fff05c
...
...
@@ -95,6 +95,7 @@ class Manager
'filter_hashtags'
=>
false
,
'pinned_guids'
=>
null
,
'as_activities'
=>
false
,
'exclude'
=>
null
,
],
$opts
);
if
(
isset
(
$opts
[
'query'
])
&&
$opts
[
'query'
])
{
...
...
Core/Feeds/Top/Repository.php
View file @
66fff05c
...
...
@@ -53,6 +53,7 @@ class Repository
'exclude_moderated'
=>
false
,
'moderation_reservations'
=>
null
,
'pinned_guids'
=>
null
,
'exclude'
=>
null
,
],
$opts
);
if
(
!
$opts
[
'type'
])
{
...
...
@@ -67,6 +68,8 @@ class Repository
throw
new
\Exception
(
'Unsupported period'
);
}
$type
=
$opts
[
'type'
];
$body
=
[
'_source'
=>
array_unique
([
'guid'
,
...
...
@@ -75,7 +78,7 @@ class Repository
'time_created'
,
'access_id'
,
'moderator_guid'
,
$this
->
getSourceField
(
$
opts
[
'
type
'
]
),
$this
->
getSourceField
(
$type
),
]),
'query'
=>
[
'function_score'
=>
[
...
...
@@ -98,7 +101,7 @@ class Repository
'sort'
=>
[],
];
/*if ($
opts['
type
']
=== 'group' && false) {
/*if ($type === 'group' && false) {
if (!isset($body['query']['function_score']['query']['bool']['must_not'])) {
$body['query']['function_score']['query']['bool']['must_not'] = [];
}
...
...
@@ -107,7 +110,7 @@ class Repository
'access_id' => ['0', '1', '2'],
],
];
} elseif ($
opts['
type
']
=== 'user') {
} elseif ($type === 'user') {
$body['query']['function_score']['query']['bool']['must'][] = [
'term' => [
'access_id' => '2',
...
...
@@ -236,7 +239,7 @@ class Repository
}
}
if
(
$
opts
[
'
type
'
]
!==
'group'
&&
$opts
[
'access_id'
]
!==
null
)
{
if
(
$type
!==
'group'
&&
$opts
[
'access_id'
]
!==
null
)
{
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must'
][]
=
[
'terms'
=>
[
'access_id'
=>
Text
::
buildArray
(
$opts
[
'access_id'
]),
...
...
@@ -294,6 +297,14 @@ class Repository
}
}
if
(
$opts
[
'exclude'
])
{
$body
[
'query'
][
'function_score'
][
'query'
][
'bool'
][
'must_not'
][]
=
[
'terms'
=>
[
'guid'
=>
Text
::
buildArray
(
$opts
[
'exclude'
]),
],
];
}
// firehose options
...
...
@@ -338,9 +349,15 @@ class Repository
//
$esType
=
$opts
[
'type'
];
if
(
$esType
===
'all'
)
{
$esType
=
'object:image,object:video,object:blog'
;
}
$query
=
[
'index'
=>
$this
->
index
,
'type'
=>
$
opts
[
't
ype
'
]
,
'type'
=>
$
esT
ype
,
'body'
=>
$body
,
'size'
=>
$opts
[
'limit'
],
'from'
=>
$opts
[
'offset'
],
...
...