From e123585dde33f8ec3be13e788eea6fc10041920f Mon Sep 17 00:00:00 2001 From: rvelices Date: Mon, 17 Jan 2011 21:16:42 +0000 Subject: bug 2105 : Browsing tags is slow if tags contains many photos git-svn-id: http://piwigo.org/svn/trunk@8726 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_search.inc.php | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'include/functions_search.inc.php') diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php index a8b005517..08cd675a2 100644 --- a/include/functions_search.inc.php +++ b/include/functions_search.inc.php @@ -231,23 +231,18 @@ SELECT DISTINCT(id) { $query .= "\n AND ".$images_where; } - if (empty($tag_items) or $search['mode']=='AND') - { // directly use forbidden and order by - $query .= $forbidden.' + $query .= $forbidden.' '.$conf['order_by']; - } $items = array_from_query($query, 'id'); } if ( !empty($tag_items) ) { - $need_permission_check = false; switch ($search['mode']) { case 'AND': if (empty($search_clause)) { - $need_permission_check = true; $items = $tag_items; } else @@ -263,27 +258,8 @@ SELECT DISTINCT(id) $tag_items ) ); - if ( $before_count < count($items) ) - { - $need_permission_check = true; - } break; } - if ($need_permission_check and count($items) ) - { - $query = ' -SELECT DISTINCT(id) - FROM '.IMAGES_TABLE.' i - INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id - WHERE id IN ('.implode(',', $items).') '.$forbidden; - if (!empty($images_where)) - { - $query .= "\n AND ".$images_where; - } - $query .= ' - '.$conf['order_by']; - $items = array_from_query($query, 'id'); - } } return $items; -- cgit v1.2.3