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:
parent
3677f99dda
commit
c0ec756d50
2 changed files with 77 additions and 70 deletions
|
@ -18,9 +18,9 @@ if($query->param('query'))
|
|||
|
||||
$strquery = $query->param('query');
|
||||
$strquery =~ s/%([0-9A-F]{2})/chr(hex($1))/eg;
|
||||
(@tags) = $strquery =~ /tag:(\w+)/gi;
|
||||
($orderby) = $strquery =~ /orderby:(\w+)/i;
|
||||
($sort) = $strquery =~ /sort:(\w+)/i;
|
||||
(@tags) = $strquery =~ / tag:(\w+)/gi;
|
||||
($orderby) = $strquery =~ / orderby:(\w+)/i;
|
||||
($sort) = $strquery =~ / sort:(\w+)/i;
|
||||
#($title) = $strquery =~ /title:(\w+)/i;
|
||||
#($description) = $strquery =~ /description:(\w+)/i;
|
||||
#($creator) = $strquery =~ /creator:(\w+)/i;
|
||||
|
@ -31,7 +31,7 @@ if($query->param('query'))
|
|||
#($filesize) = $strquery =~ /filesize:([<>]?\w+)/i;
|
||||
#($duration) = $strquery =~ /duration:([<>]?\w+)/i;
|
||||
#($timestamp) = $strquery =~ /timestamp:([<>]?\w+)/i;
|
||||
$strquery =~ s/(tag|orderby|sort):\w+//gi;
|
||||
$strquery =~ s/ (tag|orderby|sort):\w+//gi;
|
||||
$strquery =~ s/^\s*(.*?)\s*$/$1/;
|
||||
|
||||
#build mysql query
|
||||
|
@ -41,16 +41,18 @@ if($query->param('query'))
|
|||
duration, width, height, fps, viewcount, downloadcount";
|
||||
|
||||
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 .= " 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)";
|
||||
push @args, $strquery, $strquery;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbquery .= " from videos as v, users as u where u.id = v.userid";
|
||||
}
|
||||
|
||||
if(@tags)
|
||||
{
|
||||
|
@ -119,6 +121,11 @@ if($query->param('query'))
|
|||
{
|
||||
print output_page();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $query->redirect("index.pl?error=error_no_query");
|
||||
}
|
||||
}
|
||||
elsif($query->param('advanced'))
|
||||
{
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
<string id="path_root">http://localhost/</string>
|
||||
<string id="path_upload">/upload.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_mostdownloads">/search.pl?query=orderby:downloadcount%20sort:descending</string>
|
||||
<string id="path_query_mostviews">/search.pl?query=orderby:viewcount%20sort:descending</string>
|
||||
<string id="path_query_latestadditions">/search.pl?query=*%20orderby:timestamp%20sort:descending</string>
|
||||
<string id="path_query_mostdownloads">/search.pl?query=*%20orderby:downloadcount%20sort:descending</string>
|
||||
<string id="path_query_mostviews">/search.pl?query=*%20orderby:viewcount%20sort:descending</string>
|
||||
|
||||
</strings>
|
||||
|
||||
|
|
Loading…
Reference in a new issue