[% WRAPPER page_layout %]



    [% PROCESS form %]
    <p>
    [% IF result.shown %]
        [% PROCESS results_header %]
        [% PROCESS display_results %]
        <p>
        [% PROCESS next_links %]
    [% END %]

    [% IF result %]
        [% IF result.message %]
            <div class="message">[% result.message %]</div>
        [% ELSIF ! result.hits %]
            <div class="message">No Results Found</div>
        [% END %]
    [% END %]

[% END %]

[% BLOCK form %]
<div class="search-form">
    <form method="get" action="[% request.myself %]" enctype="application/x-www-form-urlencoded">
        <input type="text" name="query" value="" size="40" maxlength="200" />
        <input type="submit" name="submit" value="Search!" /><br>
        Limit search to:
        <input type="radio" name="metaname" value="swishdefault" checked value="swishdefault"/>Body and Title
        <input type="radio" name="metaname" value="swishtitle" />Just Title
        <input type="radio" name="metaname" value="swishdocpath" />Path
    </form>
</div>
[% END %]


[% BLOCK results_header %]
<div class="showing-header">
    Results for <b>[% request.query | html %]</b><br>
    Showing page [% result.page %] 
    ([% result.start +1 %] - [% (result.start + result.shown) %] of [% result.hits %] hits) 

    [% USE myurl = url( request.myself, query=request.query, metaname=request.metaname, size=request.pagesize ) %]

    [% PROCESS next_links %]

</div>
[% END %]

[% BLOCK next_links %]

    [% IF result.prev %]
       <a href="[% myurl( page=result.prev ) %]">Previous</a>
    [% END %]
    [% IF result.next %]
       <a href="[% myurl( page=result.next ) %]">Next</a> 
    [% END %]
[% END %]

[% BLOCK display_results %]
    [% USE date %]
    [% FOREACH item = result.results %]
        <div class="title">
            <a href="[% item.Property('swishdocpath') | uri | html %]">
                [%  item.Property('swishtitle') || 'missing title' | highlight('swishtitle', item ) %]</a>

            <span class="rank"> -- rank: <b>[% item.Property('swishrank') %]</b></span>
        </div>

        <div class="description">
            [% item.Property('swishdescription') || "No description" | highlight('swishdescription', item) %]
        </div>

        <div class="metadata">
            Path: <a href="[% item.Property('swishdocpath') | uri | html %]">
                [% item.Property('swishdocpath') | highlight('swishdocpath', item ) %]</a>
                - [% item.Property('swishdocsize') %] bytes<br>
            Date: [% date.format( item.Property('swishlastmodified')) %]<br>
        </div>
    [% END %]
[% END %]


