From 980df44dd80ebce3a1b9b30788d5662bad1b2305 Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 22 Jan 2011 15:53:01 +0000 Subject: [PATCH] strnorm bits --- core/imageboard.pack.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 1eb9405e..0b6714a7 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -600,8 +600,11 @@ class Image { else if(count($tag_querylets) == 1 && $tag_querylets[0]->positive) { $query = new Querylet($database->engine->scoreql_to_sql(" SELECT images.* FROM images - JOIN image_tags ON images.id = image_tags.image_id - WHERE tag_id = (SELECT tags.id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(?)) + WHERE images.id IN ( + SELECT image_id FROM image_tags WHERE tag_id = ( + SELECT tags.id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(?) + ) + ) "), array($tag_querylets[0]->tag)); if(strlen($img_search->sql) > 0) { @@ -901,7 +904,11 @@ class Tag { assert(is_string($tag)); global $database; - $newtag = $database->db->GetOne("SELECT newtag FROM aliases WHERE oldtag=?", array($tag)); + $newtag = $database->db->GetOne( + $database->engine->scoreql_to_sql("SELECT newtag FROM aliases WHERE SCORE_STRNORM(oldtag)=SCORE_STRNORM(?)"), + array($tag)); + + if(!empty($newtag)) { return $newtag; } else {