Add setting of suggestions options on resultset
[yaz-moved-to-github.git] / src / zoom-sru.c
index d52372f..da588f0 100644 (file)
@@ -217,6 +217,13 @@ zoom_ret ZOOM_connection_srw_send_search(ZOOM_connection c)
         ZOOM_set_error(c, ZOOM_ERROR_UNSUPPORTED_QUERY, 0);
         return zoom_complete;
     }
+   
+    option_val = ZOOM_query_get_sru11(resultset->query);
+    if (option_val)
+    {
+        sr->u.request->sort_type = Z_SRW_sort_type_sort;
+        sr->u.request->sort.sortKeys = odr_strdup(c->odr_out, option_val);
+    }
     sr->u.request->startRecord = odr_intdup(c->odr_out, *start + 1);
     sr->u.request->maximumRecords = odr_intdup(
         c->odr_out, (resultset->step > 0 && resultset->step < *count) ? 
@@ -299,6 +306,9 @@ static zoom_ret handle_srw_response(ZOOM_connection c,
         if (res->numberOfRecords) {
             resultset->size = *res->numberOfRecords;
         }
+        if (res->suggestions) {
+            ZOOM_resultset_option_set(resultset, "suggestions", res->suggestions);
+        }
         for (i = 0; i<res->num_records; i++)
         {
             int pos;