added tag search, a few improvements on the results page
git-svn-id: http://yolanda.mister-muffin.de/svn@176 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
283a2c5b32
commit
384fcb6467
6 changed files with 31 additions and 10 deletions
|
@ -17,7 +17,7 @@ sub fill_tagcloud
|
|||
while (my ($text, $count) = $sth->fetchrow_array())
|
||||
{
|
||||
#push the new value to the $page->tagcloud array
|
||||
push @{ $page->{tagcloud}->{tag} }, { text => [$text], count => [$count] };
|
||||
push @{ $page->{tagcloud}->{tag} }, { text => [$text =~ / / ? "\"$text\"" : $text], count => [$count] };
|
||||
}
|
||||
|
||||
#finish query
|
||||
|
|
|
@ -22,23 +22,36 @@ if($query->param('query') or $query->param('orderby'))
|
|||
|
||||
my @args = ();
|
||||
|
||||
$strquery = $query->param('query');
|
||||
push @tags, $strquery =~ /tag:"([^"]+)"/gi;
|
||||
push @tags, $strquery =~ /tag:(\w+)/gi;
|
||||
$strquery =~ s/(tag|title):"[^"]+"//gi;
|
||||
$strquery =~ s/(tag|title):\w+//gi;
|
||||
$strquery =~ s/^\s*(.*?)\s*$/$1/;
|
||||
|
||||
#build mysql query
|
||||
$dbquery = "select v.id, v.title, v.description, u.username, from_unixtime( v.timestamp ),
|
||||
v.creator, v.subject, v.contributor, v.source, v.language, v.coverage, v.rights,
|
||||
v.license, filesize, duration, width, height, fps, viewcount, downloadcount";
|
||||
|
||||
if($query->param('query'))
|
||||
if($strquery)
|
||||
{
|
||||
$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, $query->param('query'), $query->param('query');
|
||||
push @args, $strquery, $strquery;
|
||||
}
|
||||
else
|
||||
{
|
||||
$dbquery .= " from videos as v, users as u where u.id = v.userid";
|
||||
}
|
||||
|
||||
if(@tags)
|
||||
{
|
||||
$dbquery .= " and match(v.subject) against (? in boolean mode)";
|
||||
push @args, "@tags";
|
||||
}
|
||||
|
||||
if($query->param('orderby'))
|
||||
{
|
||||
if($query->param('orderby') eq 'filesize')
|
||||
|
|
|
@ -289,7 +289,11 @@
|
|||
</xsl:attribute>
|
||||
<fieldset>
|
||||
<xsl:value-of select="$locale_strings[@id='search']" />:
|
||||
<input type="text" name="query" size="auto" />
|
||||
<input type="text" name="query" size="30">
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="//results/@value" />
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -79,9 +79,9 @@
|
|||
<xsl:template name="results">
|
||||
<div>
|
||||
<xsl:choose>
|
||||
<xsl:when test="//results/@query!=''">
|
||||
<xsl:value-of select="$locale_strings[@id='results_for_query']" />
|
||||
"<xsl:value-of select="//results/@query" />"
|
||||
<xsl:when test="//results/@value!=''">
|
||||
<!-- <xsl:value-of select="$locale_strings[@id='results_for_query']" /> -->
|
||||
<i><xsl:value-of select="//results/@value" /></i><br />
|
||||
<xsl:if test="//results/@orderby!=''">
|
||||
<xsl:value-of select="$locale_strings[@id='ordered_by']" />
|
||||
<xsl:choose>
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
>
|
||||
|
||||
<xsl:template name="video">
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="video">
|
||||
<div class="video">
|
||||
<xsl:choose>
|
||||
|
|
Loading…
Reference in a new issue