remove one-positive-tag special case which is slower than the generic build_accurate_search_querylet

This commit is contained in:
Shish 2019-07-07 17:13:56 +01:00
parent c22f0f6df8
commit cf98e4bf43

View file

@ -888,23 +888,6 @@ class Image
"); ");
} }
// one positive tag (a common case), do an optimised search
elseif ($positive_tag_count === 1 && $negative_tag_count === 0) {
# "LIKE" to account for wildcards
$query = new Querylet($database->scoreql_to_sql("
SELECT *
FROM (
SELECT images.*
FROM images
JOIN image_tags ON images.id=image_tags.image_id
JOIN tags ON image_tags.tag_id=tags.id
WHERE SCORE_STRNORM(tag) LIKE SCORE_STRNORM(:tag)
GROUP BY images.id
) AS images
WHERE 1=1
"), ["tag"=>Tag::sqlify($tag_conditions[0]->tag)]);
}
// more than one positive tag, or more than zero negative tags // more than one positive tag, or more than zero negative tags
else { else {
$query = Image::build_accurate_search_querylet($tag_conditions); $query = Image::build_accurate_search_querylet($tag_conditions);