From 6c5e917864e96199aa27bc52ad4f4a750b743a41 Mon Sep 17 00:00:00 2001 From: Shish Date: Tue, 5 Jan 2010 09:05:16 +0000 Subject: [PATCH] search by number of tags --- ext/index/main.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ext/index/main.php b/ext/index/main.php index 007ac891..1a4c1853 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -207,6 +207,11 @@ class Index extends SimpleExtension { $val = str_replace("*", "%", $matches[1]); $event->add_querylet(new Querylet("images.posted LIKE '%$val%'")); } + else if(preg_match("/tags(<|>|<=|>=|=)(\d+)/", $event->term, $matches)) { + $cmp = $matches[1]; + $tags = $matches[2]; + $event->add_querylet(new Querylet("images.id IN (SELECT DISTINCT image_id FROM image_tags GROUP BY image_id HAVING count(image_id) $cmp $tags)")); + } } } ?>