From a92b2fdcabdd88bc4b229031220f69b633bd5e67 Mon Sep 17 00:00:00 2001 From: shish Date: Wed, 4 Jul 2007 00:56:02 +0000 Subject: [PATCH] optimise a very common (99%) case git-svn-id: file:///home/shish/svn/shimmie2/trunk@210 7f39781d-f577-437e-ae19-be835c7a54ca --- core/database.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/database.class.php b/core/database.class.php index 315b4489..d04a81ee 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -151,6 +151,11 @@ class Database { if($positive_tag_count + $negative_tag_count == 0) { $query = new Querylet($this->get_images); } + else if($positive_tag_count == 1 && $negative_tag_count == 0) { + $query = new Querylet( + "{$this->get_images} WHERE images.id IN (SELECT image_id FROM tags WHERE tag = ?) ", + $tag_search->variables); + } else { $s_tag_array = array_map("sql_escape", $tag_search->variables); $s_tag_list = join(', ', $s_tag_array);