one step towards faster searching
git-svn-id: file:///home/shish/svn/shimmie2/trunk@29 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
d0b797247f
commit
f12e0b8f60
1 changed files with 3 additions and 2 deletions
|
@ -81,6 +81,7 @@ class Database {
|
|||
private function build_search_querylet($terms) {
|
||||
$tag_search = new Querylet("0");
|
||||
$positive_tag_count = 0;
|
||||
$negative_tag_count = 0;
|
||||
$img_search = new Querylet("");
|
||||
|
||||
foreach($terms as $term) {
|
||||
|
@ -114,12 +115,12 @@ class Database {
|
|||
$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)));
|
||||
}
|
||||
}
|
||||
|
||||
$database_fails = false; // MySQL 4.0 fails at subqueries
|
||||
if(count($tag_search->variables) == 0 || $database_fails) {
|
||||
if($positive_tag_count + $negative_tag_count == 0) {
|
||||
$query = new Querylet("SELECT * FROM images ");
|
||||
}
|
||||
else {
|
||||
|
|
Reference in a new issue