<?php namespace BookStack\Http\Controllers;
-use BookStack\Actions\ViewService;
-use BookStack\Entities\Models\Book;
-use BookStack\Entities\Models\Bookshelf;
-use BookStack\Entities\Models\Entity;
+use BookStack\Entities\Queries\Popular;
use BookStack\Entities\Tools\SearchRunner;
use BookStack\Entities\Tools\ShelfContext;
use BookStack\Entities\Tools\SearchOptions;
class SearchController extends Controller
{
- protected $viewService;
protected $searchRunner;
protected $entityContextManager;
public function __construct(
- ViewService $viewService,
SearchRunner $searchRunner,
ShelfContext $entityContextManager
) {
- $this->viewService = $viewService;
$this->searchRunner = $searchRunner;
$this->entityContextManager = $entityContextManager;
}
$searchTerm .= ' {type:'. implode('|', $entityTypes) .'}';
$entities = $this->searchRunner->searchEntities(SearchOptions::fromString($searchTerm), 'all', 1, 20, $permission)['results'];
} else {
- $entities = $this->viewService->getPopular(20, 0, $entityTypes, $permission);
+ $entities = (new Popular)->run(20, 0, $entityTypes, $permission);
}
return view('search.entity-ajax-list', ['entities' => $entities]);