mirror of
https://github.com/danpros/htmly.git
synced 2026-04-19 12:06:22 +05:30
Improve the search
Improve the search speed
This commit is contained in:
parent
a504035b88
commit
d8cbaefad2
2 changed files with 41 additions and 80 deletions
|
|
@ -939,12 +939,9 @@ get('/search/:keyword', function($keyword){
|
|||
$page = $page ? (int)$page : 1;
|
||||
$perpage = config('search.perpage');
|
||||
|
||||
$posts = get_keyword($keyword);
|
||||
$posts = get_keyword($keyword, $page, $perpage);
|
||||
|
||||
$total = count($posts);
|
||||
|
||||
// Extract a specific page with results
|
||||
$posts = array_slice($posts, ($page-1) * $perpage, $perpage);
|
||||
$total = keyword_count($keyword);
|
||||
|
||||
if(empty($posts) || $page < 1){
|
||||
// a non-existing page
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue