'name',
($searchTerm || $nameFilter) ? 'value' : DB::raw('COUNT(distinct value) as `values`'),
DB::raw('COUNT(id) as usages'),
- DB::raw('SUM(IF(entity_type = \'BookStack\\\\Page\', 1, 0)) as page_count'),
- DB::raw('SUM(IF(entity_type = \'BookStack\\\\Chapter\', 1, 0)) as chapter_count'),
- DB::raw('SUM(IF(entity_type = \'BookStack\\\\Book\', 1, 0)) as book_count'),
- DB::raw('SUM(IF(entity_type = \'BookStack\\\\BookShelf\', 1, 0)) as shelf_count'),
+ DB::raw('SUM(IF(entity_type = \'page\', 1, 0)) as page_count'),
+ DB::raw('SUM(IF(entity_type = \'chapter\', 1, 0)) as chapter_count'),
+ DB::raw('SUM(IF(entity_type = \'book\', 1, 0)) as book_count'),
+ DB::raw('SUM(IF(entity_type = \'bookshelf\', 1, 0)) as shelf_count'),
])
->orderBy($nameFilter ? 'value' : 'name');
foreach ($elements as $element) {
$element = new Crawler($element);
- if (preg_match("/$pattern/i", $element->html())) {
+ if (preg_match("/$pattern/i", $element->text())) {
$matched = true;
break;
}