asterisk for empty search query

git-svn-id: http://yolanda.mister-muffin.de/svn@306 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2008-04-16 13:32:20 +00:00
parent 3677f99dda
commit c0ec756d50
2 changed files with 77 additions and 70 deletions

View file

@ -41,16 +41,18 @@ if($query->param('query'))
duration, width, height, fps, viewcount, downloadcount"; duration, width, height, fps, viewcount, downloadcount";
if($strquery) if($strquery)
{
if($strquery eq "*")
{
$dbquery .= " from videos as v, users as u where u.id = v.userid";
}
else
{ {
$dbquery .= ", match(v.title, v.description, v.subject) against( ? in boolean mode) as relevance"; $dbquery .= ", match(v.title, v.description, v.subject) against( ? in boolean mode) as relevance";
$dbquery .= " from videos as v, users as u where u.id = v.userid"; $dbquery .= " from videos as v, users as u where u.id = v.userid";
$dbquery .= " and match(v.title, v.description, v.subject) against( ? in boolean mode)"; $dbquery .= " and match(v.title, v.description, v.subject) against( ? in boolean mode)";
push @args, $strquery, $strquery; push @args, $strquery, $strquery;
} }
else
{
$dbquery .= " from videos as v, users as u where u.id = v.userid";
}
if(@tags) if(@tags)
{ {
@ -120,6 +122,11 @@ if($query->param('query'))
print output_page(); print output_page();
} }
} }
else
{
print $query->redirect("index.pl?error=error_no_query");
}
}
elsif($query->param('advanced')) elsif($query->param('advanced'))
{ {
print $query->redirect("index.pl?error=error_202c"); print $query->redirect("index.pl?error=error_202c");

View file

@ -22,9 +22,9 @@
<string id="path_root">http://localhost/</string> <string id="path_root">http://localhost/</string>
<string id="path_upload">/upload.pl</string> <string id="path_upload">/upload.pl</string>
<string id="path_uploader">/uploader.pl</string> <string id="path_uploader">/uploader.pl</string>
<string id="path_query_latestadditions">/search.pl?query=orderby:timestamp%20sort:descending</string> <string id="path_query_latestadditions">/search.pl?query=*%20orderby:timestamp%20sort:descending</string>
<string id="path_query_mostdownloads">/search.pl?query=orderby:downloadcount%20sort:descending</string> <string id="path_query_mostdownloads">/search.pl?query=*%20orderby:downloadcount%20sort:descending</string>
<string id="path_query_mostviews">/search.pl?query=orderby:viewcount%20sort:descending</string> <string id="path_query_mostviews">/search.pl?query=*%20orderby:viewcount%20sort:descending</string>
</strings> </strings>