Implement sort-default lookup in search too
authorDennis Schafroth <dennis@indexdata.com>
Wed, 19 Sep 2012 14:22:08 +0000 (16:22 +0200)
committerDennis Schafroth <dennis@indexdata.com>
Wed, 19 Sep 2012 14:22:08 +0000 (16:22 +0200)
src/http_command.c

index 6c5732e..2097eee 100644 (file)
@@ -1278,6 +1278,7 @@ static void cmd_search(struct http_channel *c)
     enum pazpar2_error_code code;
     const char *addinfo = 0;
     struct reclist_sortparms *sp;
+    struct conf_service *service = 0;
 
     if (!s)
         return;
@@ -1294,8 +1295,10 @@ static void cmd_search(struct http_channel *c)
         release_session(c, s);
         return;
     }
-    if (!sort)
-        sort = "relevance";
+    service = s->psession->service;
+    if (!sort) {
+        sort = service->default_sort;
+    }
     if (!(sp = reclist_parse_sortparms(c->nmem, sort, s->psession->service)))
     {
         error(c->response, PAZPAR2_MALFORMED_PARAMETER_VALUE, "sort");