*/
public function getBySearch($term, $whereTerms = [], $count = 20, $paginationAppends = [])
{
- $terms = explode(' ', $term);
+ preg_match_all('/"(.*?)"/', $term, $matches);
+ if (count($matches[1]) > 0) {
+ $terms = $matches[1];
+ $term = trim(preg_replace('/"(.*?)"/', '', $term));
+ } else {
+ $terms = [];
+ }
+ if (!empty($term)) {
+ $terms = array_merge($terms, explode(' ', $term));
+ }
$chapters = $this->restrictionService->enforceChapterRestrictions($this->chapter->fullTextSearchQuery(['name', 'description'], $terms, $whereTerms))
->paginate($count)->appends($paginationAppends);
$words = join('|', explode(' ', preg_quote(trim($term), '/')));