From b48cd81da5d814d405de735d7f632d1837c8267c Mon Sep 17 00:00:00 2001
From: shish <shish@7f39781d-f577-437e-ae19-be835c7a54ca>
Date: Sun, 28 Oct 2007 17:07:29 +0000
Subject: [PATCH] ignore wildcard-only searches

git-svn-id: file:///home/shish/svn/shimmie2/trunk@589 7f39781d-f577-437e-ae19-be835c7a54ca
---
 core/database.class.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/core/database.class.php b/core/database.class.php
index 320364e4..41a8858f 100644
--- a/core/database.class.php
+++ b/core/database.class.php
@@ -174,10 +174,12 @@ class Database {
 			else {
 				$term = str_replace("*", "%", $term);
 				$term = str_replace("?", "_", $term);
-				$sign = $negative ? "-" : "+";
-				if($sign == "+") $positive_tag_count++;
-				else $negative_tag_count++;
-				$tag_search->append(new Querylet(" $sign (tag LIKE ?)", array($term)));
+				if(!preg_match("/^[%_]+$/", $term)) {
+					$sign = $negative ? "-" : "+";
+					if($sign == "+") $positive_tag_count++;
+					else $negative_tag_count++;
+					$tag_search->append(new Querylet(" $sign (tag LIKE ?)", array($term)));
+				}
 			}
 		}