X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ef1b98019a0c3f123b0add8428292807eac3fe05..refs/pull/2515/head:/app/Entities/Tools/SearchIndex.php diff --git a/app/Entities/Tools/SearchIndex.php b/app/Entities/Tools/SearchIndex.php index dd68a92fa..81a5022ce 100644 --- a/app/Entities/Tools/SearchIndex.php +++ b/app/Entities/Tools/SearchIndex.php @@ -3,6 +3,7 @@ use BookStack\Entities\EntityProvider; use BookStack\Entities\Models\Entity; use BookStack\Entities\Models\SearchTerm; +use Illuminate\Support\Collection; class SearchIndex { @@ -31,7 +32,7 @@ class SearchIndex { $this->deleteEntityTerms($entity); $nameTerms = $this->generateTermArrayFromText($entity->name, 5 * $entity->searchFactor); - $bodyTerms = $this->generateTermArrayFromText($entity->getText() ?? '', 1 * $entity->searchFactor); + $bodyTerms = $this->generateTermArrayFromText($entity->getText(), 1 * $entity->searchFactor); $terms = array_merge($nameTerms, $bodyTerms); foreach ($terms as $index => $term) { $terms[$index]['entity_type'] = $entity->getMorphClass(); @@ -75,8 +76,8 @@ class SearchIndex $entityModel->newQuery() ->withTrashed() ->select($selectFields) - ->chunk(1000, function ($entities) { - $this->indexEntities($entities); + ->chunk(1000, function (Collection $entities) { + $this->indexEntities($entities->all()); }); } }