X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a042e22481181fd6d7ef608142e084b106f8274c..refs/pull/2902/head:/app/Entities/Tools/SearchIndex.php diff --git a/app/Entities/Tools/SearchIndex.php b/app/Entities/Tools/SearchIndex.php index 687b9d072..cc0b32d6a 100644 --- a/app/Entities/Tools/SearchIndex.php +++ b/app/Entities/Tools/SearchIndex.php @@ -1,8 +1,11 @@ -searchTerm = $searchTerm; $this->entityProvider = $entityProvider; } - /** * Index the given entity. */ @@ -41,7 +42,8 @@ class SearchIndex } /** - * Index multiple Entities at once + * Index multiple Entities at once. + * * @param Entity[] $entities */ protected function indexEntities(array $entities) @@ -75,8 +77,8 @@ class SearchIndex $entityModel->newQuery() ->withTrashed() ->select($selectFields) - ->chunk(1000, function ($entities) { - $this->indexEntities($entities); + ->chunk(1000, function (Collection $entities) { + $this->indexEntities($entities->all()); }); } } @@ -109,8 +111,8 @@ class SearchIndex $terms = []; foreach ($tokenMap as $token => $count) { $terms[] = [ - 'term' => $token, - 'score' => $count * $scoreAdjustment + 'term' => $token, + 'score' => $count * $scoreAdjustment, ]; }