Added pz:sort setting
authorSebastian Hammer <quinn@indexdata.com>
Tue, 15 Sep 2009 02:32:04 +0000 (02:32 +0000)
committerSebastian Hammer <quinn@indexdata.com>
Tue, 15 Sep 2009 02:32:04 +0000 (02:32 +0000)
doc/pazpar2_conf.xml
src/client.c
src/settings.c
src/settings.h

index 4cf49d8..9f0272d 100644 (file)
        </para>
       </listitem>
     </varlistentry>
+
+    <varlistentry>
+      <term>pz:sort</term>
+      <listitem>
+        <para>
+         Specifies sort criteria to be applied to the result set. Only works for targets
+         which support the sort service.
+       </para>
+      </listitem>
+    </varlistentry>
    </variablelist>
   </refsect2>
 
index 2cf8eb5..5036aab 100644 (file)
@@ -489,6 +489,7 @@ void client_start_search(struct client *cl)
     const char *opt_requestsyn = session_setting_oneval(sdb, PZ_REQUESTSYNTAX);
     const char *opt_maxrecs = session_setting_oneval(sdb, PZ_MAXRECS);
     const char *opt_sru = session_setting_oneval(sdb, PZ_SRU);
+    const char *opt_sort = session_setting_oneval(sdb, PZ_SORT);
 
     assert(link);
 
@@ -527,6 +528,8 @@ void client_start_search(struct client *cl)
         ZOOM_query q = ZOOM_query_create();
         yaz_log(YLOG_LOG, "Search %s CQL: %s", sdb->database->url, cl->cqlquery);
         ZOOM_query_cql(q, cl->cqlquery);
+       if (*opt_sort)
+           ZOOM_query_sortby(q, opt_sort);
         rs = ZOOM_connection_search(link, q);
         ZOOM_query_destroy(q);
     }
index 2159628..3b7a923 100644 (file)
@@ -65,6 +65,7 @@ static char *hard_settings[] = {
     "pz:sru",
     "pz:sru_version",
     "pz:pqf_prefix",
+    "pz:sort",
     0
 };
 
index cce76e6..623a477 100644 (file)
@@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #define PZ_SRU           15
 #define PZ_SRU_VERSION   16
 #define PZ_PQF_PREFIX    17
+#define PZ_SORT                 18
 
 struct setting
 {