less nesting, 25% speed gain

This commit is contained in:
Shish 2012-05-16 07:36:20 +01:00
parent 708b117b2a
commit 545f5234bb

View File

@ -706,11 +706,9 @@ class Image {
else if(count($tag_querylets) == 1 && $tag_querylets[0]->positive) { else if(count($tag_querylets) == 1 && $tag_querylets[0]->positive) {
$query = new Querylet($database->engine->scoreql_to_sql(" $query = new Querylet($database->engine->scoreql_to_sql("
SELECT images.* FROM images SELECT images.* FROM images
WHERE images.id IN ( JOIN image_tags ON images.id=image_tags.image_id
SELECT image_id FROM image_tags WHERE tag_id = ( JOIN tags ON image_tags.tag_id=tags.id
SELECT tags.id FROM tags WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag) WHERE SCORE_STRNORM(tag) = SCORE_STRNORM(:tag)
)
)
"), array("tag"=>$tag_querylets[0]->tag)); "), array("tag"=>$tag_querylets[0]->tag));
if(!empty($img_search->sql)) { if(!empty($img_search->sql)) {