- $terms = explode(' ', preg_quote(trim($term)));
- $chapters = $this->chapter->fullTextSearch(['name', 'description'], $terms, $whereTerms);
- $words = join('|', $terms);
+ $terms = $this->prepareSearchTerms($term);
+ $chapterQuery = $this->permissionService->enforceChapterRestrictions($this->chapter->fullTextSearchQuery(['name', 'description'], $terms, $whereTerms));
+ $chapterQuery = $this->addAdvancedSearchQueries($chapterQuery, $term);
+ $chapters = $chapterQuery->paginate($count)->appends($paginationAppends);
+ $words = join('|', explode(' ', preg_quote(trim($term), '/')));