minor tweak to search SQL, huge speedup in several cases
git-svn-id: file:///home/shish/svn/shimmie2/branches/branch_2.0@26 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
e0e774a420
commit
a090d45ce0
@ -123,10 +123,14 @@ class Database {
|
|||||||
$query = new Querylet("SELECT * FROM images ");
|
$query = new Querylet("SELECT * FROM images ");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$s_tag_array = array_map("sql_escape", $tag_search->variables);
|
||||||
|
$s_tag_list = join(', ', $s_tag_array);
|
||||||
|
|
||||||
$subquery = new Querylet("
|
$subquery = new Querylet("
|
||||||
SELECT *, SUM({$tag_search->sql}) AS score
|
SELECT *, SUM({$tag_search->sql}) AS score
|
||||||
FROM images
|
FROM images
|
||||||
LEFT JOIN tags ON tags.image_id = images.id
|
LEFT JOIN tags ON tags.image_id = images.id
|
||||||
|
WHERE tags.tag IN ({$s_tag_list})
|
||||||
GROUP BY images.id
|
GROUP BY images.id
|
||||||
HAVING score = ?",
|
HAVING score = ?",
|
||||||
array_merge(
|
array_merge(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user