From ea29b80ec2942f7e0390e3bb98c37ac6c4c5686d Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sun, 1 Apr 2018 17:10:21 +0200 Subject: Remove unused method "getSearchResultIDs" from Page and Post class --- core/namespace/Page/Item.php | 14 -------------- core/namespace/Post/Item.php | 21 --------------------- 2 files changed, 35 deletions(-) (limited to 'core/namespace') diff --git a/core/namespace/Page/Item.php b/core/namespace/Page/Item.php index cd2c94f..563602a 100644 --- a/core/namespace/Page/Item.php +++ b/core/namespace/Page/Item.php @@ -26,20 +26,6 @@ class Item extends \Item { return sha1(implode(NULL, $attributes)); } - #=============================================================================== - # Return unique page IDs for search results - #=============================================================================== - public static function getSearchResultIDs($search, \Database $Database): array { - $Statement = $Database->prepare(sprintf("SELECT id FROM %s WHERE - MATCH(name, body) AGAINST(? IN BOOLEAN MODE) LIMIT 20", Attribute::TABLE)); - - if($Statement->execute([$search])) { - return $Statement->fetchAll($Database::FETCH_COLUMN); - } - - return []; - } - #=============================================================================== # Return search results as Page\Attribute #=============================================================================== diff --git a/core/namespace/Post/Item.php b/core/namespace/Post/Item.php index 71d8014..84b5f43 100644 --- a/core/namespace/Post/Item.php +++ b/core/namespace/Post/Item.php @@ -26,27 +26,6 @@ class Item extends \Item { return sha1(implode(NULL, $attributes)); } - #=============================================================================== - # Return unique post IDs for search results - #=============================================================================== - public static function getSearchResultIDs($search, array $date, \Database $Database): array { - $D = ($D = intval($date[0])) !== 0 ? $D : 'NULL'; - $M = ($M = intval($date[1])) !== 0 ? $M : 'NULL'; - $Y = ($Y = intval($date[2])) !== 0 ? $Y : 'NULL'; - - $Statement = $Database->prepare(sprintf("SELECT id FROM %s WHERE - ({$Y} IS NULL OR YEAR(time_insert) = {$Y}) AND - ({$M} IS NULL OR MONTH(time_insert) = {$M}) AND - ({$D} IS NULL OR DAY(time_insert) = {$D}) AND - MATCH(name, body) AGAINST(? IN BOOLEAN MODE) LIMIT 20", Attribute::TABLE)); - - if($Statement->execute([$search])) { - return $Statement->fetchAll($Database::FETCH_COLUMN); - } - - return []; - } - #=============================================================================== # Return search results as Post\Attribute #=============================================================================== -- cgit v1.2.3