added sort by any combination of swish-e fields which are defined by
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 15 Feb 2005 21:48:16 +0000 (21:48 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 15 Feb 2005 21:48:16 +0000 (21:48 +0000)
PropertyNames in swish_isis.conf. This allowed adition of links which show
search results sorted by time, author and title then author or autor than
titme combination.

Any combination of fields for sorting can be specified (separated by spaces),
with optional asc(ending) or desc(ending) order.

git-svn-id: file:///home/dpavlin/private/svn/webpac/trunk@659 13eb9ef6-21d5-0310-b721-a9d68796d827

WebPac.pm
swish_isis.conf
template_html/results.html

index 800833a..a08a711 100644 (file)
--- a/WebPac.pm
+++ b/WebPac.pm
@@ -344,6 +344,10 @@ sub show_results_list {
                $sort = 'headline';
                push @persist_vars, "sort";
        }
+       if ($q->param("sortby")) {
+               $sort = $q->param("sortby");
+               push @persist_vars, "sort";
+       }
 
        # construct swish query
        my $sw_q = join(" and ",@s_arr);
@@ -369,6 +373,7 @@ sub show_results_list {
        my $search = $swish->New_Search_Object;
 
        $search->SetSort($sort);
+print "sort: $sort\n";
 
        my $results = $search->Execute($sw_q);
        $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
index 68d96cc..8915bad 100644 (file)
@@ -77,3 +77,6 @@ IndexAdmin "dpavlin@rot13.org"
 
 ParserWarnLevel 0
 IndexReport 0
+
+# what additional properties to store? (used for sortby variable for WebPac.pm)
+PropertyNames personalname_swish date_swish titleandresponsibility_swish publisher_swish language_swish udc_swish otherclass_swish library_swish series_swish
index 5183c58..94279a9 100644 (file)
   <p>Na upit <TMPL_VAR search> pronaĆ°eno je <TMPL_VAR hits> rezultata ...
   </p>
 
+  <p>Sortiraj prema:
+       <a href="<TMPL_VAR NAME="url_params">&sortby=personalname_swish">autoru</a>,
+       <a href="<TMPL_VAR NAME="url_params">&sortby=titleandresponsibility_swish">naslovu</a>,
+       <a href="<TMPL_VAR NAME="url_params">&sortby=personalname_swish titleandresponsibility_swish">autoru i naslovu</a>,
+       <a href="<TMPL_VAR NAME="url_params">&sortby=titleandresponsibility_swish personalname_swish">naslovu i autoru</a>
+  </p>
+
   <TABLE BORDER=1 WIDTH="100%">
   <TR><TD class="results" colspan=2>