From 36965226acd25178ce3d28633aadc1749f85b9f2 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 1 Apr 2018 17:06:20 +0200 Subject: Replace method calls "getSearchResultIDs" with "getSearchResults" This commit replaces the method calls of "Item::getSearchResultIDs" with "Item::getSearchResults". In addition, the associated Item instances (Page or Post) are therefore now created with "Factory::buildByAttribute" instead of "Factory::build" (because "getSearchResults" returns an array of Attribute instances while "getSearchResultIDs" had returned an array of unique item IDs without attribute data). --- core/include/search/main.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'core/include/search') diff --git a/core/include/search/main.php b/core/include/search/main.php index 8854b79..5a9708e 100644 --- a/core/include/search/main.php +++ b/core/include/search/main.php @@ -11,7 +11,7 @@ $M_LIST = $Database->query(sprintf('SELECT DISTINCT MONTH(time_insert) AS temp F $Y_LIST = $Database->query(sprintf('SELECT DISTINCT YEAR(time_insert) AS temp FROM %s ORDER BY temp', Post\Attribute::TABLE)); if($search = HTTP::GET('q')) { - if(!$postIDs = Post\Item::getSearchResultIDs($search, [HTTP::GET('d'), HTTP::GET('m'), HTTP::GET('y')], $Database)) { + if(!$attributes = Post\Item::getSearchResults($search, [HTTP::GET('d'), HTTP::GET('m'), HTTP::GET('y')], $Database)) { $message = $Language->text('search_no_results', escapeHTML($search)); } } @@ -38,10 +38,10 @@ $search_data = [ # TRY: Template\Exception #=============================================================================== try { - if(isset($postIDs) AND !empty($postIDs)) { - foreach($postIDs as $postID) { + if(isset($attributes) AND !empty($attributes)) { + foreach($attributes as $Attribute) { try { - $Post = Post\Factory::build($postID); + $Post = Post\Factory::buildByAttribute($Attribute); $User = User\Factory::build($Post->attr('user')); $posts[] = generatePostItemTemplate($Post, $User); -- cgit v1.2.3