mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-22 14:49:59 +08:00
Made search more efficient and tweaked weighting
Added per-entity weighting changes. Now Books score higher than chapters which score higher than pages. Reduced queries required on search by only searching once but at a higher count to see if there's another page.
This commit is contained in:
@ -40,13 +40,12 @@ class SearchController extends Controller
|
||||
$nextPageLink = baseUrl('/search?term=' . urlencode($searchTerm) . '&page=' . ($page+1));
|
||||
|
||||
$results = $this->searchService->searchEntities($searchTerm, 'all', $page, 20);
|
||||
$hasNextPage = $this->searchService->searchEntities($searchTerm, 'all', $page+1, 20)['count'] > 0;
|
||||
|
||||
return view('search/all', [
|
||||
'entities' => $results['results'],
|
||||
'totalResults' => $results['total'],
|
||||
'searchTerm' => $searchTerm,
|
||||
'hasNextPage' => $hasNextPage,
|
||||
'hasNextPage' => $results['has_more'],
|
||||
'nextPageLink' => $nextPageLink
|
||||
]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user