fix issue with selection of columns
This commit is contained in:
parent
fd11442a76
commit
6369637145
|
|
@ -83,8 +83,8 @@ class SearchController extends ListDiscussionsController
|
||||||
// their ids as most relevant post id
|
// their ids as most relevant post id
|
||||||
$results = Collection::make(Arr::get($response, 'hits.hits'))
|
$results = Collection::make(Arr::get($response, 'hits.hits'))
|
||||||
->map(function ($hit) {
|
->map(function ($hit) {
|
||||||
$id = Str::after($hit['_source']['id'], ':');
|
|
||||||
$type = $hit['_source']['type'];
|
$type = $hit['_source']['type'];
|
||||||
|
$id = Str::after($hit['_source']['id'], "$type:");
|
||||||
|
|
||||||
if ($type === 'posts') {
|
if ($type === 'posts') {
|
||||||
return [
|
return [
|
||||||
|
|
@ -92,12 +92,13 @@ class SearchController extends ListDiscussionsController
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
return [
|
return [
|
||||||
'discussion_id' => $id
|
'discussion_id' => $id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$discussions = Discussion::query()
|
$discussions = Discussion::query()
|
||||||
|
->select('discussions.*')
|
||||||
->join('posts', 'posts.discussion_id', 'discussions.id')
|
->join('posts', 'posts.discussion_id', 'discussions.id')
|
||||||
->whereIn('discussions.id', $results->pluck('discussion_id')->filter())
|
->whereIn('discussions.id', $results->pluck('discussion_id')->filter())
|
||||||
->orWhereIn('posts.id', $results->pluck('most_relevant_post_id')->filter())
|
->orWhereIn('posts.id', $results->pluck('most_relevant_post_id')->filter())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue